View previous topic :: View next topic |
Author |
Message |
DaveR Valued Contributor
Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Wed Jul 25, 2007 4:08 am Post subject: Using FlashWindowEx or FlashWindow |
|
|
Can someone show me how to use FlashWindowEx or FlashWindow from user32.dll ?
I can't get it to flash a window. Here's what I've been trying:
Code: |
DIALOG CREATE,New Dialog,-1,0,300,200
DIALOG SHOW
rem %%hwnd = @winexists("New Dialog")
DIALOG CREATE,Flash Me,-1,0,240,160
DIALOG SHOW
%%hwnd = @winexists("Flash Me")
window iconize,Flash Me
loadlib user32.dll
:Evloop
wait event,0.5
goto @event()
:Close
freelib user32.dll
stop
:Timer
if %%bInvert
%%bInvert = 0
else
%%bInvert = 1
end
rem %R = @lib(user32,FlashWindow,INT:%%hwnd,INT:%%bInvert)
rem %R = @lib(user32,FlashWindow,%%hwnd,%%bInvert)
rem %R = @lib(user32,FlashWindow,STR:%%hwnd,STR:%%bInvert)
rem %R = @lib(user32,FlashWindow,%%hwnd,INT:%%bInvert)
rem %R = @lib(user32,FlashWindow,INT,%%hwnd,INT:%%bInvert)
rem %R = @lib(user32,FlashWindow,INT,%%hwnd,%%bInvert)
%R = @lib(user32,FlashWindowEx,INT,%%hwnd,%%bInvert)
goto evloop
|
PS The reason I'm not using the built in VDS Window Flash command is because it's so slow. Changing the delay between flashes only seems to change the delay between the first 2 flashes - after that it goes back to the slow default setting. _________________ cheers
Dave |
|
Back to top |
|
|
Rubes_sw Valued Contributor
Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Wed Jul 25, 2007 7:26 am Post subject: |
|
|
Hi Dave
Did you try vdsflash.dll by PGWARE ?
Quote: |
This is an extension for Visual DialogScript (32-bit version.) It adds a FLASHWINDOW command to the vocabulary of VDS. The dll allows users to flash a windows' titlebar or its' taskbar button if the window is minimized. A programmer typically wants to flash a window when you need a user's attention and your application has been hidden by other windows' or is minimzed. This extension is freeware for any type of usage. The dll comes with the source code so you can make modifications if you would like to. The source code was compiled in Borland Delphi 6.
|
Heres a link: http://www.vdsworld.com/search.php?keywords=vdsflash.dll&match_type=%200&sid=6925c88d8304edfb7d04e5d0e359ea17
Nathan |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Jul 25, 2007 3:33 pm Post subject: |
|
|
Dave,
Is there something wrong with the VDS built in flash command?
Code: |
WINDOW FLASH, <window>, <number of flashes>, <delay between flashes>
|
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Jul 25, 2007 3:36 pm Post subject: |
|
|
Dave,
Anyway the issue you are having with using the API functions is that you need to remove the '%' character from the begining of the %%hwnd variable for the window ID. You can do something like this...
Code: |
%%hwnd = @Strdel(%%hwnd,1,1)
|
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
DaveR Valued Contributor
Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Wed Jul 25, 2007 3:56 pm Post subject: |
|
|
Thanks Nathan _________________ cheers
Dave |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Jul 25, 2007 6:28 pm Post subject: |
|
|
Dave,
If you don't want to use the DLL below is the code you need to make both the FlashWindow and FlashWindowEx API's work.
Code: |
#DEFINE COMMAND,FLASHWINDOW,FLASHWINDOWEX
#Flash both the window caption and taskbar button. This is equivalent to setting the FLASHW_CAPTION | FLASHW_TRAY flags.
%%FLASHW_ALL = $00000003
# Flash the window caption.
%%FLASHW_CAPTION = $00000001
# Stop flashing. The system restores the window to its original state.
%%FLASHW_STOP = 0
# Flash continuously, until the FLASHW_STOP flag is set.
%%FLASHW_TIMER = $00000004
# Flash continuously until the window comes to the foreground.
%%FLASHW_TIMERNOFG = $0000000C
# Flash the tray icon
%%FLASHW_TRAY = $00000002
loadlib user32.dll
DIALOG CREATE,Flash Me,-1,0,240,160
DIALOG SHOW
#%%hwnd = @winexists("Flash Me")
FlashWindowEx Flash Me,@sum(%%FLASHW_CAPTION,%%FLASHW_TIMER),0,5
WAIT 5
FlashWindowEx Flash Me,%%FLASHW_STOP,0,0
FlashWindowEx Flash Me,@sum(%%FLASHW_TRAY,%%FLASHW_TIMER),0,5
WAIT 5
FlashWindowEx Flash Me,%%FLASHW_STOP,0,0
FlashWindowEx Flash Me,@sum(%%FLASHW_ALL,%%FLASHW_TIMER),0,5
WAIT 5
FlashWindowEx Flash Me,%%FLASHW_STOP,0,0
window iconize,Flash Me
:Evloop
wait event,0.5
goto @event()
:Close
freelib user32.dll
stop
:Timer
FlashWindow Flash Me
goto evloop
:FlashWindow
# The FlashWindow API needs to be put in a loop.
%%char = @SubStr(%1,1,1)
If @Equal(%%char,"%")
%%hwnd = @Strdel(%1,1,1)
ElsIf @Equal(%%char,"#")
%%hwnd = @Winexists(%1)
%%hwnd = @Strdel(%%hwnd,1,1)
Else
%%hwnd = @Winexists(%1)
%%hwnd = @Strdel(%%hwnd,1,1)
End
if @Equal(%%bInvert,1)
%%bInvert = 0
else
%%bInvert = 1
end
%R = @lib(user32,FlashWindow,INT,INT:%%hwnd,INT:%%bInvert)
Exit
:FlashWindowEx
# This is the extended version of FlashWindow
# it has several extra abilities and does not require
# being put into a loop.
%%char = @SubStr(%1,1,1)
If @Equal(%%char,"%")
%%hwnd = @Strdel(%1,1,1)
ElsIf @Equal(%%char,"#")
%%hwnd = @Winexists(%1)
%%hwnd = @Strdel(%%hwnd,1,1)
Else
%%hwnd = @Winexists(%1)
%%hwnd = @Strdel(%%hwnd,1,1)
End
%%cbSize = @binary(DWORD,20)
%%hwnd = @binary(DWORD,%%hwnd)
%%dwFlags = @Binary(DWORD,%2)
%%nCount = @Binary(DWORD,%3)
%%dwTimeout = @Binary(DWORD,%4)
%F = %%cbSize%%hwnd%%dwFlags%%nCount%%dwTimeout
%R = @lib(user32,FlashWindowEx,INT,INT:@addr("%F"))
Exit
|
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
DaveR Valued Contributor
Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Thu Jul 26, 2007 2:45 am Post subject: |
|
|
Thanks DragonSphere. Works great!
BTW I noticed you spotted a mistake that I didn't find until after I'd posted:
Code: | if %%bInvert
%%bInvert = 0
else
%%bInvert = 1
end |
Code: | if @Equal(%%bInvert,1)
%%bInvert = 0
else
%%bInvert = 1
end |
_________________ cheers
Dave |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|