Jump to content

[solved] How to define a Pointer ?


Exit
 Share

Go to solution Solved by Exit,

Recommended Posts

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

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
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.

Link to comment
Share on other sites

  • Solution

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...