Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link Windows API: Set Last active window active again 2002-07-27 -- Jody Ronning Newsgroups: comp.lang.clarion
Thanks... but I found a solution. Running the following program via the
quick launch bar will restore the active window on the way out. Works on
Windows 2000... have to test on Windows 98.
--
Jody Ronning - Innovative Software Creations
E-Mail: iscreations(AT)iscreations.com
Web: http://www.iscreations.com
PROGRAM
INCLUDE('KEYCODES.CLW')
INCLUDE('EQUATES.CLW')
LPSTR EQUATE(CSTRING)
HANDLE EQUATE(UNSIGNED)
HWND EQUATE(HANDLE)
DWORD EQUATE(ULONG)
MAP
MODULE('Windows API')
GetWindow(HWND,UNSIGNED),HWND,PASCAL
GetWindowTextLength(HWND),SIGNED,PASCAL,NAME('GetWindowTextLengthA')
SetForegroundWindow(HWND),BOOL,PASCAL
IsWindowVisible(HWND),BOOL,PASCAL
END
END
HiddenWindow WINDOW('Hidden Window'),AT(,,118,69),CENTER,SYSTEM,GRAY
END
CurrWin LONG
TopWin LONG
TitleLen LONG
GW_HWNDFIRST EQUATE(0)
GW_HWNDNEXT EQUATE(2)
CODE
OPEN(HiddenWindow)
HiddenWindow{PROP:Hide} = 1
ACCEPT
CASE EVENT()
OF EVENT:OpenWindow
CurrWin = GetWindow(HiddenWindow{PROP:Handle}, GW_HWNDFIRST)
LOOP WHILE CurrWin <> 0
TitleLen = GetWindowTextLength(CurrWin)
IF TitleLen > 0 and IsWindowVisible(CurrWin)
TopWin = CurrWin
BREAK
END
CurrWin = GetWindow(CurrWin, GW_HWNDNEXT)
end
POST(EVENT:CloseWindow)
OF EVENT:CLoseWindow
BREAK
END
END
CLOSE(HiddenWindow)
!-- Do my code that doesn't need a window
!-- Select the prev active window on the way out
IF TopWin > 0 AND SetForegroundWindow(TopWin)
END
RETURN
"I v e k y" wrote in message
news:ahphmh$4gmv$1@as201.hinet.hr...
> is there any Get/Set ForegroundApp() API call?
>
>
> "Jody Ronning"
Today is December 3, 2024, 11:18 am This article has been viewed 35270 times. Google search has resulted in 392 hits on this article since January 25, 2004.
|
|