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

Bo Berglund Bo.Berglund at system3r.se
Tue Mar 21 12:41:14 GMT 2006


Community technical support mailing list was retired 2010 and replaced with a professional technical support team. For assistance please contact: Pre-sales Technical support via email to sales@march-hare.com.


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.

    'Added declare for use with W2000+ window handling. 2001-02-13 BB
    'The function SystemParametersInfo is braindamaged by Microsoft!
    'In order to make this work correctly the same function must be
declared in two different
    'ways, one where the 3rd parameter is ByRef and the other ByVal!!
    'Depending on usage set by param #1 SystemParametersInfo treats the
parameters differently,
    'for GET types it is treated as a pointer (as is defined in the API
documentation) but for
    'SET types the 3rd parameter must be given as ByVal otherwise the
address of the entered
    'variable is used instead of the variable value!!!
    'This was reverse engineered 2002-01-15 by BB
    Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long,
ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
    Declare Function SystemParametersInfoSet Lib "user32" Alias
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long,
ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long


Sub WMAN_SetWindowPopUpResponse()
    Dim TimeOut As Long
    Dim nRes As Long
    'The function SystemParametersInfo is braindamaged by Microsoft!
    'In order to make this work correctly the same function must be
declared in two different
    'ways, one where the 3rd parameter is ByRef and the other ByVal!!
    'Depending on usage SystemParametersInfo treats the parameters
differently, for GET
    'types it is treated as a pointer (as is defined in the API
documentation) but for
    'SET types the 3rd parameter must be given as ByVal otherwise the
address of the entered
    'variable is used instead of the variable value!!!
    'This was reverse engineered 2002-01-15 by BB

    nRes = SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0&,
TimeOut, 0&)
    
    Call STAT_LogEvents(LOG_EVENT, "Foreground window lock time before =
" & TimeOut, 0)
    
    TimeOut = 100 'Set to 100 ms
    
    nRes = SystemParametersInfoSet(SPI_SETFOREGROUNDLOCKTIMEOUT, 0&,
TimeOut, SPIF_SENDWININICHANGE) ' Or SPIF_UPDATEINIFILE)
    nRes = SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0&,
TimeOut, 0&)
    Call STAT_LogEvents(LOG_EVENT, "Foreground window lock time after =
" & TimeOut, 0)

End Sub 

HTH

Best regards,

Bo Berglund


-----Original Message-----
From: cvsnt-bounces at cvsnt.org [mailto:cvsnt-bounces at cvsnt.org] On Behalf
Of Tony Hoyle
Sent: den 21 mars 2006 13:25
To: cvsnt at cvsnt.org cvsnt downloads at march-hare.com @CVSNT on Twitter CVSNT on Facebook
Subject: Re: [cvsnt] cvsagent: Always stay on top - persistent?

Oliver Giesen wrote:

> I fully agree with this sentiment generally. However, the cvsagent is
a
> different matter IMO because it does never pop up out of context. It
is

Microsoft also agree - since XP at least applications cannot force 
themselves onto the top.  cvsagent does everything it can to get onto 
the top of the window list but the OS simply doesn't allow it to brute 
force its way to the top.

If there aren't many applications open it seems to let it.. not sure of 
the rules it's using.

Tony
_______________________________________________
cvsnt mailing list
cvsnt at cvsnt.org cvsnt downloads at march-hare.com @CVSNT on Twitter CVSNT on Facebook
http://www.cvsnt.org/cgi-bin/mailman/listinfo/cvsnt https://www.march-hare.com/cvspro/en.asp#downcvs



More information about the cvsnt mailing list
Download the latest CVSNT, TortosieCVS, WinCVS etc. for Windows 8 etc.
@CVSNT on Twitter   CVSNT on Facebook