petrojelly 0 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 ? Share this post Link to post Share on other sites
petrojelly 0 Posted January 25, 2005 is there any way to know if a dllcall is successful or not ? Share this post Link to post Share on other sites
Valik 478 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 Share this post Link to post Share on other sites
CyberSlug 6 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! Share this post Link to post Share on other sites
petrojelly 0 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 Share this post Link to post Share on other sites
SumTingWong 1 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) Share this post Link to post Share on other sites
petrojelly 0 Posted January 26, 2005 Thank you pacman i should have seen my mistake Share this post Link to post Share on other sites