Gustavo,
You could use a TIMER that after some time, gives the focus again to your application.
Antonio:
Is there a way to send an Alt-Tab keystroke to Windows ? Where I can find more info on setting up a timer ? Thank you.
Gustavo,
> Where I can find more info on setting up a timer ?
Please review FWH/samples/TestTime.prg
Antonio:
I'm calling a 32 bit FWH program from a 16bit one. The 16bit one cannot be ported now to FWH (over 20,000 lines), so basically I need the FWH program to return focus to the 16bit app. Any ideas ? Thank you
Gustavo,
You can use FindWindow( 0, cTitle ) to get the handle of the window to give the focus to and then call SetFocus( hWnd )
http://msdn.microsoft.com/en-us/library/ms646312(VS.85).aspx
Antonio:
Thanks for the tip. I've already used the FindWindow() but in this case our user can have more than 1 instance of the program open (with the same caption). I think on 3 possible solutions:
1. Emulate an Alt-Tab keystroke ?
2. Find out which window called Program B and return control to it.
3. Generate a new caption for each Program A instance.
Any suggestions ? Thank you.
Hunter,
If I understand correctly, you want to call another program from the FW program, then return focus to the FW program. Since you already know the handle of the window doing the calling of the other program, then just try:
SetFocus( oWnd:hWnd )
Where oWnd is the window of the appliction that is calling the other program.
Regards,
James
James:
Thanks for the advice. Now here's what I'm trying to do.
1. App A (16bit Clipper) calls App B (FWH)
2. App B (FWH) RUNs START /B /I APP C (FWH)
3. App C stays open and returns control to App B, which automatically closes.
4. Focus goes back to App C but I need it (focus) back to App A (16bit)
Converting App A to FWH is now out of the question (over 20,000 lines and customers won't wait). Any ideas ?
Gustavo,
You can write the handle of the A window in a file from the A application:
MemoWrit( "handleA.txt", AllTrim( Str( oWndMain:hWnd ) )
Then from C, read handleA.txt using MemoRead( "handleA.txt" ) and give the focus to it:
SetFocus( Val( MemoRead( "handleA.txt" ) ) )
Antonio:
That's what I thought, but how I get the window handle in app A since FiveWin is not linked ? If I tried to linked it, Clipper runs out of memory. Is there a C function that I can call from Clipper to get the window handle ? Thank you very much.
Gustavo,
Is app A a MsDos application ?
Antonio:
Yes, App A is a MS-DOS 16 bit Clipper program.