Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Com Interop Conditional Implements Statement
Message
From
11/06/2011 13:18:44
 
 
To
11/06/2011 03:39:12
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01513528
Message ID:
01514130
Views:
57
Don't need the components to be present during the build by our testing using the path and filename - just the tlb file in the expected path. You do need them registered during runtime though.


>(1) Just wondering, how can you build on the build server without having all the necessary components present ?
>
>(2) At run time, the file and the build have to exist, and you do not know where they are - the user may have chosen another place for the installation
>
>I think that is why you can use the progId
>
>
>>No, that won't work - only for the build. At runtime, the file and path have to exist and it is a different location depending on 32bit or 64bit. the only real solution is for the 3rd party provider of the .net dll to build one to run on 64bit so it can go in the same location as it does on 32 bit - in \Program Files not \Program Files(x86).
>>
>>Checking on the progid stuff from Rick's recommendation earlier but not sure we want every 3rd party com dll registered on the build server...
>>
>>
>>>Never used the implements - but if you only want one exe why not
>>>
>>>(1) ensure "C:\Program Files (x86)\netappdirectory\filename.tlb" exists on the build server
>>>
>>>(2) DEFINE CLASS AppEvents AS SESSION
>>> IMPLEMENTS iEvents IN "C:\Program Files (x86)\netappdirectory\filename.tlb"
>>>
>>>
>>>
>>>So it will always compile on the build server
>>>
>>>Finally test whether the exe works on both 32 bit and 64 bit systems
>>>
>>>
>>>
>>>
>>>>Thanks but it's a no-go. :( In both cases, we have to compile a 32 bit version (with the path there) and a 64 bit version (with the x86 path there) for this to work. don't want two separate exes... and if the path doesn't exist at build time (which it won't on a build server), then it won't work for either :(
>>>>
>>>>
>>>>>Untested but worth trying
>>>>>
>>>>>
>>>>>
>>>>>#if file("C:\Program Files\netappdirectory\filename.tlb")
>>>>>#     define TLB_FILE  "C:\Program Files\netappdirectory\filename.tlb"
>>>>>#else
>>>>>#     define TLB_FILE  "C:\Program Files (x86)\netappdirectory\filename.tlb"
>>>>>#endif
>>>>>
>>>>>DEFINE CLASS AppEvents AS SESSION
>>>>>IMPLEMENTS iEvents IN  TLB_FILE  
>>>>>
>>>>>
>>>>>
>>>>>or
>>>>>
>>>>>
>>>>>DEFINE CLASS AppEvents AS SESSION
>>>>>#if file("C:\Program Files\netappdirectory\filename.tlb")
>>>>>IMPLEMENTS iEvents IN   "C:\Program Files\netappdirectory\filename.tlb"
>>>>>#else
>>>>>IMPLEMENTS iEvents IN   "C:\Program Files (x86)\netappdirectory\filename.tlb"
>>>>>#endif
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>I posted this question yesterday, but do not see it in my list of messages so reposting....
>>>>>>
>>>>>>
>>>>>>I have a class defined for com interop with a .net dll which works great -- i hook into the events and can pass to/from the .net dll and fire events in vfp from the .net dll.
>>>>>>
>>>>>>The issue is Windows 7 64 versus 32 bit. The .net dll is always installed in the program files unless of course it is 64 bit windows which then installs into program files (x86).....
>>>>>>
>>>>>>In the DEFINE CLASS section, I have to point to the .tlb in the IMPLEMENTS statement
>>>>>>
>>>>>>If I point explicitly to the location:
>>>>>>
>>>>>>DEFINE CLASS AppEvents AS SESSION
>>>>>>IMPLEMENTS iEvents IN "C:\Program Files\netappdirectory\filename.tlb"
>>>>>>
>>>>>>or
>>>>>>
>>>>>>IMPLEMENTS iEvents IN "C:\Program Files (x86)\netappdirectory\filename.tlb"
>>>>>>
>>>>>>both work fine.
>>>>>>
>>>>>>However in the class definition, I cannot use (syntax errors -- not allowed):
>>>>>>
>>>>>>IF DIRECTORY(look for x86) AND FILE() etc...
>>>>>> IMPLEMENTS iEvents IN "C:\Program Files (x86)\netappdirectory\filename.tlb"
>>>>>>ELSE
>>>>>> .....
>>>>>>ENDIF
>>>>>>
>>>>>>But I can:
>>>>>>before class definition: lcNetDirfile = "C:\Program Files....."
>>>>>>and then in the class definition do this:
>>>>>>
>>>>>>IMPLEMENTS iEvents IN (EVALUATE(lcNetDirFile))
>>>>>>
>>>>>>however, it doesn't really work. It builds fine (no errors), but doesn't really work. I cannot hook into the events.
>>>>>>
>>>>>>I need a way to have a conditional use of implements in the class definition....
>>>>>>
>>>>>>Any ideas?
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform