PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Roy Chan on November 03, 2011, 01:52:19 AM

Title: How to assign a bitmap to picture control at runtime ?
Post by: Roy Chan on November 03, 2011, 01:52:19 AM
I put a picture control in the main form. But the picture control is empty. I want to put a bitmap into the picture control. I should use which function or command to do that. The bitmap is generate by the following function (QRCodeEncode SDK DLL).

Original C Header
HBITMAP __stdcall QRCodeEncode2Bitmap(QRCODECONTEXT *pQRCodeCtx)

Transalte to PB
Declare Function QRCodeEncode2Bitmap lib "QrCodeEncodeDLL.dll" alias "QRCodeEncode2Bitmap" (byref pQRCodeCtx as QRCODECONTEXT) as dword

Title: Re: How to assign a bitmap to picture control at runtime ?
Post by: José Roca on November 03, 2011, 02:06:38 AM

SendMessage (IDC_FORM1_PICTURE1, %STM_SETIMAGE, %IMAGE_BITMAP, hBitmap)

Title: Re: How to assign a bitmap to picture control at runtime ?
Post by: Roy Chan on November 03, 2011, 03:28:07 AM
Thank you very much.
Title: Re: How to assign a bitmap to picture control at runtime ?
Post by: Haakon Birkeland on November 03, 2011, 04:19:10 AM
Interesting library ...

From the name I assume it also can decode QR-codes?!
Can it also work with other types of EAN codes, or does the author perhaps have other similar libraries?
Title: Re: How to assign a bitmap to picture control at runtime ?
Post by: Roy Chan on November 03, 2011, 07:01:44 AM
Take a look at this website. There is only a few company selling the QRCode Encode & Decode SDK. I want to write a QRCode Encode Shareware.
http://www.aipsys.com/ (http://www.aipsys.com/)
Title: Re: How to assign a bitmap to picture control at runtime ?
Post by: Haakon Birkeland on November 03, 2011, 07:41:39 AM
Ouch â€" greedy ...

Splitting up the libraries like that with those prices.
Title: Re: How to assign a bitmap to picture control at runtime ?
Post by: Roy Chan on November 04, 2011, 03:18:47 AM
Dear Sir,

I try to use Loadbitmap function and assign the bitmap to picture control. But the picture controll still empty. Where is my problem ?


Dim aa As Dword

LoadBitmap  aa,"c:\1.bmp"
ztrace Str$(aa)    ' it shows the value - 0

SendMessage (IDC_FRMMAIN_PICTURE1, %STM_SETIMAGE, %IMAGE_BITMAP, aa)
Title: Re: How to assign a bitmap to picture control at runtime ?
Post by: Roy Chan on November 04, 2011, 04:21:09 AM
I fix the problem already by the following code.


Dim aa As Dword

aa = LoadImage(HWND_FRMMAIN,"c:\1.bmp", %IMAGE_BITMAP,100, 100,%LR_LOADFROMFILE)
SendMessage (HWND_FRMMAIN_PICTURE1, %STM_SETIMAGE, %IMAGE_BITMAP, aa)
FF_Control_Redraw HWND_FRMMAIN_PICTURE1