Exit Posted April 17, 2014 Share Posted April 17, 2014 (edited) I want to compare 2 images and the function _WinAPI_GetBitmapBits() needs a Pointer to a buffer. How to define such a pointer? Here a reproducer. I used the desktop screencopy to get a handle. The @extended gives a correct bytecount, but my buffer contains the old data. How to specify a pointer to my buffer correctly? #include <ScreenCapture.au3> Exit _Example() Func _Example() _GDIPlus_Startup() $hBitmap = _ScreenCapture_Capture() $Buffer = "Start of Buffer. Start of Buffer. Start of Buffer. End of Buffer. " $lBuffer = StringLen($Buffer) $pBuffer = Ptr($Buffer) $rc = _WinAPI_GetBitmapBits($hBitmap, $lBuffer, $pBuffer) MsgBox(262144, "Debug " & @ScriptName, "@Error: " & @error & @LF & "@Extended: " & @extended & @LF & "@ScriptLineNumber: " & @ScriptLineNumber & @LF & "rc: " & $rc & @LF & $Buffer, 0) _WinAPI_DeleteObject($hBitmap) _GDIPlus_Shutdown() EndFunc ;==>_Example Edited April 18, 2014 by Exit App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
SirJohann Posted April 17, 2014 Share Posted April 17, 2014 I don't know much about pointers and structs, but I've seen a example of a buffer for text and it was like...you create a struct with DllStructCreate (In your case I don't know what kind of data), in the example was char[258], and then DllStructGetPointer. Codes codes codes. Link to comment Share on other sites More sharing options...
Solution Exit Posted April 18, 2014 Author Solution Share Posted April 18, 2014 I don't know much about pointers and structs, but I've seen a example of a buffer for text and it was like...you create a struct with DllStructCreate (In your case I don't know what kind of data), in the example was char[258], and then DllStructGetPointer. Bingo. That did the trick. Many Thanks App: Au3toCmd UDF: _SingleScript() 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