Jump to content

DllCall


Recommended Posts

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
Link to comment
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).
Link to comment
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
Link to comment
Share on other sites

  • Developers

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)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
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
Link to comment
Share on other sites

  • Developers

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 ..

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...