Insolence Posted February 12, 2005 Share Posted February 12, 2005 http://msdn.microsoft.com/library/default....itmaps_0rho.aspCan't get it to work. Also noticing I have to use 'long' when it says ptr/int etc. in the DLL thread in the dev section. Global $Handle Sleep(2000) ; Chang "test" to the window you'll be testing PixelDrawConstructor( $Handle, "test" ) $GetPixel = GetPixel($Handle, 5, 5) MsgBox ( "","", $Handle[1] & " - " & $GetPixel[0]) Func PixelDrawConstructor(ByRef $DLLHandle, $WindowTitle) $DLLHandle = DllCall ("user32.dll", "int", "GetDC", "hwnd", WinGetHandle($WindowTitle, "")) EndFunc Func GetPixel($DLLHandle, $x, $y) return DllCall( "gdi32", "long", "GetPixel", "long", $DLLHandle[1], "long", $x, "long", $y ) EndFunc "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Insolence Posted February 12, 2005 Author Share Posted February 12, 2005 bump* "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Insolence Posted February 14, 2005 Author Share Posted February 14, 2005 bump AGAIN*! "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Blue_Drache Posted February 14, 2005 Share Posted February 14, 2005 bump AGAIN*!<{POST_SNAPBACK}>Perhaps a PM to the .dll god? *nudges Larry* Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Insolence Posted February 14, 2005 Author Share Posted February 14, 2005 (edited) Thanks. I have an entire period dedicated to programming now, I'll see if I can figure out the problem. Thanks for clearing things up, once again. EDIT: Noticed you edited: ;Newer code below. EDIT AGAIN: Why am I using all these wrong data types? Are they even working? I'm using what layer was using, which is blatantly different then the ones specified in the DLL Call thread in the dev section. Are those wrong? Edited February 14, 2005 by Insolence "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Insolence Posted February 14, 2005 Author Share Posted February 14, 2005 expandcollapse popup;===================================================================; ; Settings ; ;===================================================================; Opt("WinTitleMatchMode", 2) ;===================================================================; ; Variables ; ;===================================================================; Global $Handle ;===================================================================; ; Script ; ;===================================================================; ; Change to the window you'll be testing DCConstructor ( $Handle, "SciTE" ) $GetPixel = GetPixel ( $Handle, 5, 5 ) MsgBox ( "", "", $Handle & " - " & $GetPixel ) DCDescructor ( $Handle, "SciTE" ) ;===================================================================; ; Functions ; ;===================================================================; Func DCConstructor ( ByRef $HDC, $WindowTitle ) #CS HDC GetDC( HWND hWnd // handle to window ); #CE $HDC = DllCall ("user32.dll", "ptr", "GetDC", "hwnd", WinGetHandle( $WindowTitle ) ) $HDC = $HDC[0] EndFunc ;==>DCConstructor Func GetPixel ( $HDC, $x, $y ) #CS COLORREF GetPixel( HDC hdc, // handle to DC int nXPos, // x-coordinate of pixel int nYPos // y-coordinate of pixel ); #CE Local $ret $ret = DllCall( "gdi32", "int", "GetPixel", "ptr", $HDC, "int", $x, "int", $y ) Return $ret[0] EndFunc ;==>GetPixel Func DCDescructor ( ByRef $HDC, $WindowTitle ) #CS int ReleaseDC( HWND hWnd, // handle to window HDC hDC // handle to DC ); #CE $HDC = DllCall ( "user32.dll", "int", "ReleaseDC", "hwnd", WinGetHandle( $WindowTitle ), "ptr", $HDC ) EndFunc ;==>DCDescructor All I got so far... seems like the DC is getting set perfectly, as it returns a value. "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Insolence Posted February 15, 2005 Author Share Posted February 15, 2005 bump* "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Insolence Posted February 17, 2005 Author Share Posted February 17, 2005 Bumpage* "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Insolence Posted February 17, 2005 Author Share Posted February 17, 2005 (edited) Alright, thanks Lar-bear, I'll try that after school expandcollapse popup;===================================================================; ; Settings ; ;===================================================================; Opt("WinTitleMatchMode", 2) ;===================================================================; ; Variables ; ;===================================================================; Global $Handle ;===================================================================; ; Script ; ;===================================================================; ; Change to the window you'll be testing DCConstructor ( $Handle, "SciTE" ) $GetPixel = GetPixel ( $Handle, 5, 5 ) MsgBox ( "", "", $Handle & " - " & $GetPixel ) DCDescructor ( $Handle, "SciTE" ) ;===================================================================; ; Functions ; ;===================================================================; Func DCConstructor ( ByRef $HDC, $WindowTitle ) #CS HDC GetDC( HWND hWnd // handle to window ); #CE $HDC = DllCall ("user32.dll", "ptr", "GetDC", "hwnd", WinGetHandle( $WindowTitle ) ) $HDC = $HDC[0] EndFunc ;==>DCConstructor Func GetPixel ( $HDC, $x, $y ) #CS COLORREF GetPixel( HDC hdc, // handle to DC int nXPos, // x-coordinate of pixel int nYPos // y-coordinate of pixel ); #CE Local $ret $ret = DllCall( "gdi32", "int", "GetPixel", "int", $HDC, "int", $x, "int", $y ) Return $ret[0] EndFunc ;==>GetPixel Func DCDescructor ( ByRef $HDC, $WindowTitle ) #CS int ReleaseDC( HWND hWnd, // handle to window HDC hDC // handle to DC ); #CE $HDC = DllCall ( "user32.dll", "int", "ReleaseDC", "hwnd", WinGetHandle( $WindowTitle ), "ptr", $HDC ) EndFunc ;==>DCDescructor Returns -1 Edited February 17, 2005 by Insolence "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Insolence Posted February 17, 2005 Author Share Posted February 17, 2005 Alright, works now. Cannot get pixels of an inactive window (I suppose that's good), damnit. "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. 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