petrojelly Posted January 25, 2005 Share Posted January 25, 2005 Hello i am trying to detect pixel change during movie playback on windows mediaplayer. I know autoit has a build-in GetPixelColor function but it doesnt work on a movie playback. I stumbled onto a small chunk of VB6 code on google that uses GetPixel in gdi32.dll, but I am a newb programmer without visual basic background. >>I tried to translate these: Dim hdc As Long Dim color As Long hdc = GetDC(0) color = GetPixel(hdc, x, y) >>Into AutoIt3 $hdc = DllCall("user32", "hwnd", "GetDC", "hwnd", 0) $color = DllCall("gdi32", "long", "GetPixel", "hwnd", $hdc, "int", $x, "int", $y) But it seems that $color is always -1 regardless of any $x / $y values i put in Can somebody help ? Link to comment Share on other sites More sharing options...
petrojelly Posted January 25, 2005 Author Share Posted January 25, 2005 is there any way to know if a dllcall is successful or not ? Link to comment Share on other sites More sharing options...
Valik Posted January 26, 2005 Share Posted January 26, 2005 (edited) Obviously you haven't fully read the documentation for DllCall() yet. If you had, you wouldn't of asked that question, and you would also see the error in your code as to why it doesn't work.Edit: Typo (Fixed). Edited January 26, 2005 by Valik Link to comment Share on other sites More sharing options...
CyberSlug Posted January 26, 2005 Share Posted January 26, 2005 Obviously you haven't fully read the documentation for DllCall() yet. If you had, you wouldn't of asked that question, and you would also see the error in your code as to why it doesn't work.It's rather easy to miss in the docs after the big Valid Types table. I made the same mistake the first time.Return value is an array; try $result = DllCall(...)MsgBox(4096,"Info", $result[0]) Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
petrojelly Posted January 26, 2005 Author Share Posted January 26, 2005 thx for the replies i did know the return value is in arrary i made the mistake of saying " $color is always -1 " when i meant $color[0] is always -1 i'll keep trying Link to comment Share on other sites More sharing options...
SumTingWong Posted January 26, 2005 Share Posted January 26, 2005 thx for the repliesi did know the return value is in arraryi made the mistake of saying " $color is always -1 "when i meant $color[0] is always -1i'll keep trying<{POST_SNAPBACK}>If you are aware of the fact that DllCall returns an array, then you should know that your dc value should be $hdc[0] and the type should be "ptr". Have a look at Jon's DllCall thread in the developers forum for a list of valid types.$hdc = DllCall("user32", "ptr", "GetDC", "hwnd", 0) $color = DllCall("gdi32", "long", "GetPixel", "ptr", $hdc[0], "int", $x, "int", $y) Link to comment Share on other sites More sharing options...
petrojelly Posted January 26, 2005 Author Share Posted January 26, 2005 Thank you pacman i should have seen my mistake Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now