View previous topic :: View next topic |
Author |
Message |
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Jul 24, 2003 9:15 am Post subject: Window states |
|
|
Another API sample. Check window states and bring it to foreground:
Code: |
TITLE Windows states.. by Dr. Dread
REM Set the title of your test window
%%window = "new file - metapad"
REM Check if it's actually there
if @winexists(%%window)
%W = @strdel(@WINEXISTS(%%window),1,)
else
info The window @CHR(34)%%window@CHR(34) does not exist! Aborting..
stop
end
REM Load user32.dll
LOADLIB User32.dll
REM Check if the target window is not responding
%A = @lib(user32,IsHungAppWindow,BOOL:,%W)
if %A
%%Ames = yes
else
%%Ames = no
end
REM Check if the target window is minimized
%B = @lib(user32,IsIconic,BOOL:,%W)
if %B
%%Bmes = yes
else
%%Bmes = no
end
REM Check if the target window is maximized
%C = @lib(user32,IsZoomed,BOOL:,%W)
if %C
%%Cmes = yes
else
%%Cmes = no
end
REM Check if the target window is visible
%D = @lib(user32,IsWindowVisible,BOOL:,%W)
if %D
%%Dmes = yes
else
%%Dmes = no
end
info Window @CHR(34)%%window@CHR(34):@CR()@CR()Hung: %%Ames@CR()Minimized: %%Bmes@CR()Maximized: %%Cmes@CR()Visible: %%Dmes
REM Bring target window to foreground
if %B
REM Restore from minimized
%X = @lib(user32,OpenIcon,BOOL:,%W)
else
REM If not minimized, then just bring it forward
%X = @lib(user32,SetForegroundWindow,BOOL:,%W)
end
FREELIB User32
|
Greetz
Dr. Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Jul 24, 2003 4:45 pm Post subject: |
|
|
Good example Dread.
You can use the Window Class too, which is more reliable if you have it.
Code: |
%%window = #Notepad
|
_________________ -Sheep
My pockets hurt... |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
Back to top |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Jul 24, 2003 5:41 pm Post subject: |
|
|
Visible means it's restored, whether it's behind another window or not. _________________ -Sheep
My pockets hurt... |
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Jul 24, 2003 5:45 pm Post subject: |
|
|
Skit3000 wrote: | What does the 'visible' parameter mean? It's not that a window is on top or something... |
Nope, it has nothing to do with 'on top' - visible is more like 'not hidden'. Try to run a WINDOW HIDE on
your target window, then its visible state should become No.
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Jul 24, 2003 5:46 pm Post subject: |
|
|
Aaaa, Sheep's faster than me - fastest draw in the West
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Jul 24, 2003 5:50 pm Post subject: |
|
|
What do I win? _________________ -Sheep
My pockets hurt... |
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Jul 24, 2003 5:52 pm Post subject: |
|
|
Everlasting honor and a notch on your gun's handle.
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Jul 24, 2003 5:53 pm Post subject: |
|
|
Bah, I wanted money. _________________ -Sheep
My pockets hurt... |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu Jul 24, 2003 8:56 pm Post subject: |
|
|
How about a trip to the zoo? You can pet the Prakash's penguin. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1562
|
Posted: Fri Jul 25, 2003 4:20 am Post subject: |
|
|
MOoooooo |
|
Back to top |
|
|
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Fri Jul 25, 2003 4:38 am Post subject: |
|
|
I see the Penguin has since been booty raped in the Zoo by Bubba
the Bear!
-Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
Back to top |
|
|
|