Sign in to follow this  
Followers 0
layer

DllCall

9 posts in this topic

Just messing around... but for this DllCall

DllCall("user32.dll", "int", "FlashWindow", "hWnd", "Windows Media Player",;Boolean?, "FALSE")

Is this possible to do because of the BOOL statement? I don't think so... =/ But I though I'd just double check...


FootbaG

Share this post


Link to post
Share on other sites



Just messing around... but for this DllCall

DllCall("user32.dll", "int", "FlashWindow", "hWnd", "Windows Media Player",;Boolean?, "FALSE")

Is this possible to do because of the BOOL statement? I don't think so... =/ But I though I'd just double check...

<{POST_SNAPBACK}>

I can't believe you would ask this and have/are attempting to learn C++. Basic types, a book may teach you these minor details where-as a tutorial will not (At least not sufficiently).

Share this post


Link to post
Share on other sites

Thanks.


FootbaG

Share this post


Link to post
Share on other sites

Ok... I know that an "int" is a number, but I still tried supplying "TRUE" and "FALSE" for it, then I even tried 1 and 0...

$Dll = DllOpen("user32.dll")
;First attempt...:
$hWnd = "Windows Media Player"
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", "TRUE")
Sleep(1000)
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", "TRUE")

;Second attempt...:
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", "FALSE")
Sleep(1000)
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", "FALSE")

;Third attempt...:
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", "TRUE")
Sleep(1000)
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", "FALSE")

;Fourth attempt...:
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", "FALSE")
Sleep(1000)
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", "TRUE")

;Fifth attempt...:
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", 1)
Sleep(1000)
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", 1)

;Sixth attempt...:
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", 0)
Sleep(1000)
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", 1)

;Seventh attempt...:
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", 0)
Sleep(1000)
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", 0)

DllClose($Dll)

I know it's something obvious im missing... Or...? Here's the source I got it from: http://msdn.microsoft.com/library/default....flashwindow.asp

Suggestions?

Thanks! :)


FootbaG

Share this post


Link to post
Share on other sites

try this version:

$Dll = DllOpen("user32.dll")
;First attempt...:
$hWnd = WinGetHandle("")
For $x = 1 to 5
    DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", 1)
    Sleep(1000)
Next
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", 1)
DllClose($Dll)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

@JdeB, Thanks! Works perfectly :)

@Larry, Oops, forgot :">

Thanks for the support :D


FootbaG

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Sorry... To be such a bother but, I've made a function, with the help of you guys, called _WinFlash and I have two optional paremeters.

Func _WinFlash($hWnd, $OptDelay = 500, $OptFlashes = 2);Thanks to Larry and JdeB
$Dll = DllOpen("user32.dll")
For $x = 1 to $OptFlashes
    DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", 1)
    Sleep($OptDelay)
Next
DllClose($Dll)
EndFunc

_WinFlash(WinGetHandle("Windows Media Player"), 1, 10)

Now, for some reason, specifying 10 flashes, it only flashes twice, although the delay works? I tried removing the Optional delay paremeter and then the window flashed 10 times... Is there a limit to optional paremeters? Or something that I've missed...

Thanks so much... :)

EDIT: Removed the DllCall after the Next...

Edited by layer

FootbaG

Share this post


Link to post
Share on other sites

Sorry... To be such a bother but, I've made a function, with the help of you guys, called _WinFlash and I have two optional paremeters.

Func _WinFlash($hWnd, $OptDelay = 500, $OptFlashes = 2);Thanks to Larry and JdeB
$Dll = DllOpen("user32.dll")
For $x = 1 to $OptFlashes
    DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", 1)
    Sleep($OptDelay)
Next
DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", 1)
DllClose($Dll)
EndFunc

_WinFlash(WinGetHandle("Windows Media Player"), 1, 10)

Now, for some reason, specifying 10 flashes, it only flashes twice, although the delay works? I tried removing the Optional delay paremeter and then the window flashed 10 times... Is there a limit to optional paremeters? Or something that I've missed...

Thanks so much... :)

<{POST_SNAPBACK}>

Works fine... Guess 1 ms is to short to see what happends... try it with 1000..

ps: you need to remove the last DllCall() after the next ..


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Yep, looks like the $OptDelay is the problem... Not really the problem, but as you said, if it's too little, you may not see all of the flashes, thanks! :)


FootbaG

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0