Sign in to follow this  
Followers 0
siegmar

convert an image handle to pointer for DLL

6 posts in this topic

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

Share this post


Link to post
Share on other sites



How is the DLLCall defined? What have you tried?

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

This

unsigned char *Bitmap

accepts a handle?

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

Thisaccepts a handle?

Lar.

Ok, I will check it later

Thanks ..

Have a nice day

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