Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Foxtools.fll blues
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00088407
Message ID:
00090118
Views:
29
>
>George, thanks for all your help. The problem was not in Foxtools.FLL! Since I promised to keep you posted, here it is. It's to do with OLE automation!!
>
>The DLL which we use makes calls to start an OLE session with a 3270 emulator. It so transpires that because the calling application was a VFP .exe, the handle to the OLE session was being passed to VFP from the DLL on startup. On shutdown, all hell breaks loose!
>
> VFP, being the 'good' memory handler it is, sees the OLE session's handle as its own creation and promptly shuts it down. Meanwhile, MFC code lurking in the background DLL, having incremented a count internally from OleInitialize() now wants to OleUninitialize() since it is being removed from memory.
>
>You guessed it. Since the calling app was VFP, MFC passes the exception to VFP to handle, which, by now, really knows nothing about it! So it gives us the routine "VFP has performed an illegal ..." error.
>
>The moral of the story is to 'Always initialise and uninitialse OLE sessions from the calling executable, never from within a DLL or anywhere else'!

Sanjay,

Thanks for the information. Since I'm just beginning to explore the possibilities of OLE automation, the above is something I'll definitely need to keep in mind.

BTW, I think that you did a terrific job of "detective" work in running down the problem.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform