How to assign a bitmap to picture control at runtime ?

Started by Roy Chan, November 03, 2011, 01:52:19 AM

Previous topic - Next topic

Roy Chan

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

iniSoft System Technology Limited
Lenovo ThinkPad SL410 4GB Ram,
Windows XP SP3 / PBWin 10 & FireFly 3.51

José Roca


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


Roy Chan

iniSoft System Technology Limited
Lenovo ThinkPad SL410 4GB Ram,
Windows XP SP3 / PBWin 10 & FireFly 3.51

Haakon Birkeland

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?
Haakon 8o)

Roy Chan

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/
iniSoft System Technology Limited
Lenovo ThinkPad SL410 4GB Ram,
Windows XP SP3 / PBWin 10 & FireFly 3.51

Haakon Birkeland

Ouch â€" greedy ...

Splitting up the libraries like that with those prices.
Haakon 8o)

Roy Chan

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)
iniSoft System Technology Limited
Lenovo ThinkPad SL410 4GB Ram,
Windows XP SP3 / PBWin 10 & FireFly 3.51

Roy Chan

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
iniSoft System Technology Limited
Lenovo ThinkPad SL410 4GB Ram,
Windows XP SP3 / PBWin 10 & FireFly 3.51