Thanks for the pointer, Sergey. I have not used Windows API calls before, and the various things I'm trying so far (snipped from the Windows API pages on Universal Thread) are not producing the desired result.
To reiterate the problem:
I'm calling a VFP 8.0 executable from within a FoxPro 2.6 application, using the command:
RUN /N1 Foo.exe
I want the called exe to act as much like a modal form as possible. The exe consists of a Main.prg and a single form. The Main.prg says:
Application.Visible = .F.
DO FORM Foo.scx
READ EVENTS
The form has these properties set:
AlwaysOnTop = .T.
ShowWindow = 2 && top-level form
WindowType = 1 && modal
I'm trying these Windows API statements in the form's .Init() code:
* Find my window handle:
lcApplicationTitle = THISFORM.Caption
DECLARE INTEGER FindWindow IN Win32API ;
STRING @lpClassName, ;
STRING @lpWindowName
lnHWnd = FindWindow(0, @lcApplicationTitle)
* Bring my window to the foreground (though my form properties
* already do that):
DECLARE SHORT SetForegroundWindow IN USER32.DLL INTEGER hWnd
SetForegroundWindow(lnHWnd)
* Try to make mine the active window (this may happen briefly,
* but focus goes right back to the FP 2.6 app):
DECLARE INTEGER SetActiveWindow IN USER32 INTEGER hWnd
SetActiveWindow(lnHWnd)
I've looked at the return values from the Windows API calls, and they seem to be valid (non-zero). Ideas, anyone?
Charlie Hancock