Guidance
指路人
g.yi.org
Guidance Forums / Rapid-Q Basic / "SetForegroundWindow" in Win2K vs. Win98 -- HELP!

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. "SetForegroundWindow" in Win2K vs. Win98 -- HELP!
#1054
Posted by: 2003-08-05 12:11:09
Hello all,

I've been getting a headache out of trying to make the "SetForegroundWindow" work in Win2K.

I am running a second application, from my main application/form, via SHELL... when this second application finishes, I want to bring the first one back to the foreground.

It works impecably well in Win98, but in Win2K I only get the flashing bottom caption... my main application window stays in the background! 

This is the piece of code that works perfectly in Win98:

.....
SHELL "SecondApplication.exe" 
SetForegroundWindow(MainForm.Handle)
....

I've tried to use the "AllowSetForegroundWindow" function in Win2K, but it does not seem to fix it (and of course, it does not work under Win98).  I am adding it in the same form/application I want to bring to the foreground, right after the SHELL line:

.....
SHELL "SecondApplication.exe"
AllowSetForegroundWindow(GetCurrentProcessId)
SetForegroundWindow(MainForm.Handle)
.....


But this does not change anything!! (I've tested the "GetCurrentProcessId" function and it seems to work well).


Is there something else I can try?  How can I bring that main form/application back to the foreground once the SHELL application finishes?

Any help will be greatly appreciated.

Many thanks,

Aureliano
Message2. Re: "SetForegroundWindow" in Win2K vs. Win98 -- HELP!
#1055
Posted by: guidance 2003-08-05 18:28:55
ShowWindow() may help:
http://g.yi.org/_scripts/file.php?f=6428&r=2330
Message3. Re: "SetForegroundWindow" in Win2K vs. Win98 -- HELP!
#1056
Posted by: 2003-08-05 21:22:43
Thanks Guidance... but it did not work!  I get the same result, bottom caption flashing but window on the background.

I thought also about a combination of functions (like the example you mention), but can't find the correct one... and it's only under Win2K that this happens!

Any other ideas?

Thanks again,

Aureliano
Message4. Re: "SetForegroundWindow" in Win2K vs. Win98 -- HELP!
#1057
Posted by: guidance 2003-08-05 22:05:12
Then, it should be designed for that in win2k by MS!
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-3-29  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0