Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set focus to exe
Message
From
18/03/2004 13:13:55
Charlie Hancock
California Dept of Public Health
Richmond, California, United States
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00886769
Message ID:
00887613
Views:
16
Hi Sergey,

Regarding the solution you pointed me to:

********************
lpdwProcessId = 0
lnThreadVFP = GetCurrentThreadID()
lnThread2 = GetWindowThreadProcessId(GetForegroundWindow(), @lpdwProcessId)
if ( lnThreadVFP # lnThread2 )
AttachThreadInput(lnThreadVFP, lnThread2, 1)
SetForegroundWindow(VFPwindowhandle)
AttachThreadInput(lnThreadVFP, lnThread2, 0)
else
SetForegroundWindow(VFPwindowhandle)
endif
********************

If it's not too much trouble, could you provide the DECLARE statements that make those Windows API functions visible? They aren't all working for me.

Also, is it really necessary to deal with threads? I'm trying to get a VFP form, which is already a top-level form on top of all other application forms, to give itself the focus. Shouldn't I just need the window handle for my form (ThisForm.HWnd) to pass to the appropriate API function (SetActiveWindow() and/or SetForegroundWindow())?

By the way, I get the desired behavior when I RUN the VFP exe from a FP 2.6 command window, but not when I RUN it from the compiled FP 2.6 app.

Thanks again,

Charlie
Charlie Hancock
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform