Sign in to follow this  
Followers 0
Exit

[solved] How to define a Pointer ?

3 posts in this topic

#1 ·  Posted (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 by Exit

My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

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


My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
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
Sign in to follow this  
Followers 0