Jump to content

convert an image handle to pointer for DLL


siegmar
 Share

Recommended Posts

Hallo

I am new in Autoit and Windows programming and sorry for my stupid questions.

I am at home in the microcontroller world.

I have connected an black and white LCD Display to the USB Port.

I can talk to the Display with a DLL routine, written in C.

This is working well. I can create pointers with DllStructCreate,DllStructSetDate and then

DllStructGetPtr.

From the sample script _GDIPlus_BitmapCreateFromFile.au3

I make a Bitmapclone

$myClone = _GDIPlus_BitmapCloneArea ($hImage, 0, 0,320,240,$GDIP_PXF01INDEXED )

$myclone is now an image handle to an image with 1 bit per pixel.

How I can transform an handle from an image to an pointer for my DLL ??

It make me crazy !!!!

Thanks in advance for your answer.

Have a nice day

cheers Siegmar

Link to comment
Share on other sites

Hi Lar

Thanks for your reply

This is the DLL Call in C

;LUI_Bitmap (int DevNum, unsigned char ScreenNr, int ScreenPosX,

;~ int ScreenPosY, int BMPoffsetX, int BMPoffsetY,

;~ int BMPWidth, int BMPHight, int BMPdataWidth,

;~ int BMPdataHight, unsigned char *Bitmap);

When I load an stored image file, the following code fragment is working

$result = DllCall($dll,"ubyte","LUI_Bitmap","int",$devNum,"byte",0,"int",0,"int" _

,0,"int",0,"int",0,"int",320,"int",240,"int",320,"int",240, _

"ptr",DllStructGetPtr($image_struct))

now I want to send the image with the handle $myclone to the DLL

$myClone = _GDIPlus_BitmapCloneArea ($hImage, 1250-320, 1024-240, 320, 240, $GDIP_PXF01INDEXED)

So I need the pointer from the image.

cheers

Siegmar

Link to comment
Share on other sites

Hi Lar

Thanks for your reply

This is the DLL Call in C

;LUI_Bitmap (int DevNum, unsigned char ScreenNr, int ScreenPosX,

;~ int ScreenPosY, int BMPoffsetX, int BMPoffsetY,

;~ int BMPWidth, int BMPHight, int BMPdataWidth,

;~ int BMPdataHight, unsigned char *Bitmap);

When I load an stored image file, the following code fragment is working

$result = DllCall($dll,"ubyte","LUI_Bitmap","int",$devNum,"byte",0,"int",0,"int" _

,0,"int",0,"int",0,"int",320,"int",240,"int",320,"int",240, _

"ptr",DllStructGetPtr($image_struct))

now I want to send the image with the handle $myclone to the DLL

$myClone = _GDIPlus_BitmapCloneArea ($hImage, 1250-320, 1024-240, 320, 240, $GDIP_PXF01INDEXED)

So I need the pointer from the image.

cheers

Siegmar

You could try this to see if it works. A handle is a pointer.

$myClone = _GDIPlus_BitmapCloneArea($hImage, 1250 - 320, 1024 - 240, 320, 240, $GDIP_PXF01INDEXED)

$result = DllCall($dll, "ubyte", "LUI_Bitmap", "int", $devNum, "byte", 0, "int", 0, "int" _
        , 0, "int", 0, "int", 0, "int", 320, "int", 240, "int", 320, "int", 240, _
        "hwnd", $myClone)

Examples of DllCall() calls can be found in the include directory in GDIPlus.au3 and WinAPI.au3 files, just to mention two.

Or instead of "hwnd", try "ptr". I am only guessing.

Edited by Malkey
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...