The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: hfheatherfox07 on May 18, 2011, 08:52:21 PM

Title: Custom Icon doesn't show up when using MessageBoxIndirect
Post by: hfheatherfox07 on May 18, 2011, 08:52:21 PM
Hi,

I can not get my custom Icon to show up using  MB_USERICON...in a message box using MessageBoxIndirect....any ideas why?

Title: Re: Custom Icon doesn't show up when using MessageBoxIndirect
Post by: jj2007 on May 18, 2011, 10:11:19 PM
Works like a charm.
if 1
push hInstance
pop mbp.hInstance
else
mov mbp.hInstance, NULL
endif
Title: Re: Custom Icon doesn't show up when using MessageBoxIndirect
Post by: hutch-- on May 19, 2011, 12:54:27 PM
This is the proc I use. Just make sure the icon ID is the same as in you RC file, do not pass an icon handle to it.



; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

MsgboxI proc hParent:DWORD,pText:DWORD,pTitle:DWORD,mbStyle:DWORD,IconID:DWORD

    LOCAL mbp   :MSGBOXPARAMS

    or mbStyle, MB_USERICON

    mov mbp.cbSize,             SIZEOF mbp
    m2m mbp.hwndOwner,          hParent
    mov mbp.hInstance,          rv(GetModuleHandle,0)
    m2m mbp.lpszText,           pText
    m2m mbp.lpszCaption,        pTitle
    m2m mbp.dwStyle,            mbStyle
    m2m mbp.lpszIcon,           IconID
    mov mbp.dwContextHelpId,    NULL
    mov mbp.lpfnMsgBoxCallback, NULL
    mov mbp.dwLanguageId,       NULL

    invoke MessageBoxIndirect,ADDR mbp

    ret

MsgboxI endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
Title: Re: Custom Icon doesn't show up when using MessageBoxIndirect
Post by: hfheatherfox07 on May 21, 2011, 04:08:51 PM
Thanks all , here is the finished project if any body wants it.... I also added a "ding" sound to one version...