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