` Comment on an Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Add a comment to an Icetips Article

Please 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!

Your Name:  
Email:  
Header text/Subject:  

Please enter your comment in the box below:

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" wrote in message > news:uk0ggu9303296a@corp.supernews.com... > > Anyone have a suggestion?? > > > > - Jody > > > > "Jody Ronning" wrote in message > > news:ujsb674or2m99c@corp.supernews.com... > > > I have a problem... let's say notepad is the active window. I want to > have > > a > > > shortcut on the quick launch bar. When clicked, I want to run a clarion > > > program that doesn't have a GUI. Now the problem... when my program > > exits.. > > > the last window that was active is no longer active. i.e. the user must > > > click on the notepad window to activate it again. > > > > > > I have been experimenting with some APIs but haven't got the right > > > combination yet. Any ideas? > > > > > > I am pretty sure I have to use GetForegroundWindow(),HWND,PASCAL. I then > > > used SetForegroundWindow(HWND),BOOL,PASCAL... the API said it worked... > > but > > > notepad didn't become the active window. I am pretty sure > > > GetForegroundWindow() returned the task bar since I clicked on the quick > > > launch bar to launch my clarion app. I started to go down the path of > > > GetClassName(HWND,*LPSTR,SIGNED),SIGNED,PASCAL,RAW,NAME('GetClassNameA') > > to > > > see if it was the task bar.... but thought I would send a message here > to > > > see if someone found a better method. > > > > > > Thanks! > > > > > > -- > > > Jody Ronning - Innovative Software Creations > > > E-Mail: iscreations(AT)iscreations.com > > > Web: http://www.iscreations.com > > > > > > > > > > > >


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.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: