The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: peaslee on May 11, 2012, 04:22:36 PM

Title: Static control with bitmap
Post by: peaslee on May 11, 2012, 04:22:36 PM
I just can't get this to work:


DlgProc PROC hWnd:HWND,iMsg:DWORD,wParam:WPARAM, lParam:LPARAM
        .if iMsg==WM_INITDIALOG
        invoke LoadBitmap,hInstance,IDB_ABOUT_LOGO
mov    hAboutBitmap, eax                           ; icon handle
invoke GetDlgItem, hWnd, IDC_ABOUT_LOGOSTATIC       ; eax = handle of dialog static control

Invoke SendDlgItemMessage, eax, IDC_ABOUT_LOGOSTATIC,  STM_SETIMAGE, IMAGE_BITMAP, hAboutBitmap



It would seem to be a common task, to put the bitmap into the static control, but I have been unable to find an example.

I just corrected the title spelling.  :bg
Title: Re: Staic contyrol with bitmap
Post by: peaslee on May 11, 2012, 04:37:06 PM
Never mind. It a style error and the wrong code.    ::)
Title: Re: Static control with bitmap
Post by: dedndave on May 11, 2012, 05:15:30 PM
if you use GetDlgItem - you have a handle for the static, so you can use SendMessage
if you use SendDlgItemMessage, you do not need to get a handle to the static first - just use the control ID

if you need to store the static handle for other purposes, use the first method   :P