akajmf
asked on
Delphi/Windows 2000 inactive window problem.
HI,
I currently have a program that has been built with Delphi 5, and when I run this program on Windows Me or 2000 it has a problem with inactive windows. Simply starting up the program will cause the vary first window to go inactive. This has not been a problem with 95, 98, or NT. It would be great if someone could tell me what causes it and how to fix it
I currently have a program that has been built with Delphi 5, and when I run this program on Windows Me or 2000 it has a problem with inactive windows. Simply starting up the program will cause the vary first window to go inactive. This has not been a problem with 95, 98, or NT. It would be great if someone could tell me what causes it and how to fix it
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
When the program is started a splash screen comes up as it connects to a server, when this is done a log in screen appears and that is what goes inactive. Various other forms go inactive throughout the whole program also, but it happens on the firs form the most.
Did you try
FormX.BringToFront;
FormX.BringToFront;
You may try some of these
SetForegroundWindow(Handle );
BringWindowToTop(WindowHan dle);
SendMessage(Handle,WM_SETF OCUS,0,0);
But somewhere in the MSDN I red (about a year ago) that there is a new policy in windows 2000 about bringing windows to front. E.g. if your program has no focus, it can't retreive it because the user may enter a password in that very moment expecting other app to catch it... I'd better search for that article again. It was about "What's new in Windows 2000"
SetForegroundWindow(Handle
BringWindowToTop(WindowHan
SendMessage(Handle,WM_SETF
But somewhere in the MSDN I red (about a year ago) that there is a new policy in windows 2000 about bringing windows to front. E.g. if your program has no focus, it can't retreive it because the user may enter a password in that very moment expecting other app to catch it... I'd better search for that article again. It was about "What's new in Windows 2000"
It's right that you are not allowed to steal focus from the foreground window/application in ME&2000 in some situations, but this sounds like another situation. I go with Epsylon, I guess simply using InactiveForm.BringToFront after the splash screen should fix the problem.
Regards, Madshi.
Regards, Madshi.
ASKER
Thanks you all for your help. I am testing it and will soon let you know if any of your suggestions work.
if epsylons ForceForegroundWindow() doesn't work (it doesn't on my system - W2K SP1) take a look at this thread:
https://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=20089680
the provided answer works for me. if you don't want to pay the 10 points I can repost the answer.
good luck
https://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=20089680
the provided answer works for me. if you don't want to pay the 10 points I can repost the answer.
good luck
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept Epsylon's comment as answer
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Thank you,
Russell
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
Accept Epsylon's comment as answer
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Thank you,
Russell
EE Cleanup Volunteer
Regards, Madshi.