[cvsnt] cvsagent: Always stay on top - persistent?

Tony Hoyle tony.hoyle at march-hare.com
Tue Mar 21 12:51:05 GMT 2006


Bo Berglund wrote:
> This is code snippets we needed to add to our program (Visual Basic, I
> have the Delphi version as well) when MS decided that pop-up is bad.
> We needed our dialogs to come out on top so the user could see them...
> 
> It is a user level system setting so each user needs to set the value.
> Basically the timeout set determines the time from last keyboard entry
> until it is OK to pop a window on top.

Hmm interesting.  Apparently it also works to set that value to 0, 
display the popup and change it back again.

I also found this which sounds cleaner than changing a global parameter:

function ForceForegroundWindow(hWnd: THandle): BOOL;
var
   hCurWnd: THandle;
begin
   hCurWnd := GetForegroundWindow;
   AttachThreadInput(
     GetWindowThreadProcessId(hCurWnd, nil),
     GetCurrentThreadId, True);
   Result := SetForegroundWindow(hWnd);
   AttachThreadInput(
     GetWindowThreadProcessId(hCurWnd, nil),
     GetCurrentThreadId, False);
end;

None of this is tested of course..

Tony



More information about the cvsnt mailing list