Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fire an event in one VFP program from another VFP progra
Message
From
07/01/2003 18:01:59
 
 
To
06/01/2003 01:30:58
Keith Payne
Technical Marketing Solutions
Florida, United States
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00737929
Message ID:
00739099
Views:
36
Thanks for your response, Keith.

I have no problem getting access to the Window, and I can bring it to the top of the ZOrder, but I cannot fire an event in it. As far as I know, {window}.Activate (which you recommend) will not fire across separate FoxPro executables.

As to rearchitecting the app, this IS the rearchitected application, rearchitected because of all the weird problems we got when running the second window as a top-level window within FoxPro, yielding two top-level windows. There are various and sundry problems relating to modal forms and undesirable interactions between the two top-level windows that made me abandon the single-EXE approach.

I am trying the separate EXE approach because the two windows should operate entirely independently, except that I want to put a button on the first window that either launches or activates the second window. I've gotten all the way there except for the problem of actually "activating" (e.g. setting focus to) the second window.


>>I have a button in FoxPro Task1 that launches FoxPro Task2 (separate executables). If the user returns to FoxPro Task1 while Task2 is waiting for events, and presses the button again, I want to "activate" Task2: that is, I want to bring Task2 to the top of the ZOrder and fire some event in Task2 (preferably the form's Activate event).
>>
>>I can use SetForegroundWindow() to bring the window to the top of the ZOrder, but no event is fired. Notably, if I use Alt-Tab to switch context between Task1 and Task2, no event fires in Task2. I suspect that if I solve the problem for Alt-Tab I will also have solved it for SetForegroundWindow().
>>
>>Is there a FoxPro event in the target window that fires when SetForegroundWindow() is executed? Alternatively, is there a way with VFP 7 that I can capture the apropriate Windows event?
>
>Jack,
>
>You can use Task2's MAIN window title to determine if it is still running.
>Check FAQ #7957 to get a feel for identifying windows tasks (processes). >There is a API function similar to GetWindowThreadProcessId that will give >you the title of the window. You'll have to poke around in the MSDN >Knowledgebase (http://msdn.microsoft.com) to find the exact function name.
>
>In any case, you will not be able to intercept Alt-tab task switching >inside your VFP application.
>
>To answer the second part of your question, you could write a wrapper >function for SetForegroundWindow() that fires a the Activate() event in the >target form.
>
>
>function MySetForegroundWindow(cFormName as String)
>
> local cCommand
>
> cCommand = cFormName+".Activate()"
> &cCommand
>
>end function
>A final note: Getting VFP to behave like a multi-threaded application is >nearly an impossible task. I suggest re-analyzing your project to see if >there is another way of accomplishing your goals without two separate >tasks.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform