OK, I finally got MASM32 downloaded so I can ditch the TASM5 I've been using. I must admit, things DO seem to be progressing a bit more quickly now. Here's where I'm stumped: Is it possible to use "SendMessage" (or SendDlgItemMessage)with BM_SETIMAGE to load a bitmap onto a button when the button was created in the template? From the msdn lookups I've done, it seems as though it SHOULD work...
Am I completely off-base on this, or what? Would the button have to be created in the dialog template differently? Can "BS_BITMAP" be used in a template with PUSHBUTTON or DEFPUSHBUTTON controls? Or did I just make a REALLY retarted oversight somewhere? Once again, any and all help would be appreciated.
invoke LoadBitmap, hDlg, 100 mov bmpHandle,eax invoke GetDlgItem,hDlg,IDC_TEST_BUTTON mov hBtn,eax invoke SendMessage,hBtn,BM_SETIMAGE,IMAGE_BITMAP,bmpHandle
Make sure LoadBitmap returns a valid bitmap handle
Q, This is the code I use in the MASM32 library module butv you MUST make sure you set the static control to SS_BITMAP or else it will not work. invoke LoadBitmap,hModule,bmpID mov hBmp, eax invoke SendMessage,hStatic,STM_SETIMAGE,IMAGE_BITMAP,hBmp Your code looks like it should work OK, it differes only in that you gwet the handle with GetDlgItem() which should work OK. Good luck with it, firstname.lastname@example.org
Iczelion's got it right. LoadBitmap is failing. Not sure just why it's failing, but it is. I'll keep messing with it, if you've got any ideas, please let me know.
What you posted was
where hutch has
invoke LoadBitmap, hDlg, 100
A dialog handle is a window handle, but the API needs a module/instance handle (for the loaded EXE or DLL file). The needed handle references the file that contains the bit map. To get the handle of the EXE file, you can use (if you haven't already),
invoke LoadBitmap, hModule, bmpID
In the immortal words of Homer Simpson: "DOH!" Yep, I was using the dialog handle alright... Unfortunately, the EXE handle doesn't seem to work either. LoadBitmap fails either way. I guess I'll have to go over Icz's bitmap tutorial again, I _know_ I must be missing something really simple.
DOH! Finally got it...
and in the dialog template:
100 BITMAP "bitmap.bmp"
and of course, in the code:
PUSHBUTTON "", 4321, 15,40,20,20, BS_BITMAP
Thanks for the help... Will probably be back with another "newbie" question in a few minutes... Hard to believe I was once pretty handy with ASM, eh? Back in the days when DOS ruled the PC universe... I'll get this win32 stuff down eventually.
invoke GetModuleHandle, NULL invoke LoadBitmap, eax, 100 mov hBmp,eax . . . invoke GetDlgItem,hDlg,4321 invoke SendMessage,eax,BM_SETIMAGE,IMAGE_BITMAP,hBmp