Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
COM/DLL Can I display Fox Screens from a VFP DLL?
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00527213
Message ID:
00527979
Views:
37
>>>I would like to expand the potential market for a fox application I've developed over several years. I created a COM/DLL using VFP 6 which contained several procedures from my application.. When I creatobject() and call a funtions in the DLL I get the following error if I try to display ANY messages, forms or print from inside the DLL
>>>
>>>"OLE IDispatch exception code 1031 user interface not allowed at this time"
>>>
>>>Is there a way arround this?
>>
>>The answer is "Yes".
>>By design you cannot directly use any visual interface VFP commands from within the COM objects. But that does not mean that you cannot have a visual interface with your COM objects in indirect way. In fact, you can have WAIT window, messageboxes etc, coming to the client application from the COM/DCOM module.
>>Find my article "Raise Events From Your Applications" in February 2001 FoxPro Advisor and you will see how to do this. The samples also show how to do this from VB client app.
>>
>>I will have a session at San Diego DevCon in September which is called "Create a Visual Interface for Visual FoxPro COM/DCOM".
>>
>>The problem still stays with printing reports from COM DLL, as VFP tries to pop up the "Printing... " message on screen.
>
>Nick,
>Will VFP 7 event binding help us with this? Will non-vfp clients bind with VFP 7 events?

No, not directly. With EventHandler() function (or with VFPCOM.DLL in VFP 6) you can bind VFP to the events from other applications. But VFP 7 still cannot raise events by itself, so there is nothing to bind to, say, from VB.

My approach to this (as described in the article) - you can make your VFP application to raise the real event, visible from other application. But a little VB 6 COM object which I called EventRaiser.DLL does the actual event raising. Note, that in this case the meaning of "VFP application" is wider - I include there VB COM module, just like you consider, say, the TreeView or Calendar (written in C++ ? VB?) ActiveX controls a part of your VFP application.

The VFP (or VFP COM object) code, when necessary, calls oEventRaiser.FireEvent() method with 2 parameters - the name of the event and the actual value. So, you can bind the events of VB client app to the EventRaiser.DLL events, but these events are completely controlled from your VFP code.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform