News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Own/User defined Icon on Messagebox

Started by bloodhound, April 23, 2006, 06:26:12 AM

Previous topic - Next topic

bloodhound

how do you do this?? instead of ICON_INFORMATION, etc etc..
you load your own icon on the messagebox

or you just create a child window?

hutch--

Can't be done in a normal message box. Give the following code a blast, you can set your own icon this way.


; ¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤

MessageBoxI proc hParent:DWORD,lpMsg:DWORD,
             lpTitle:DWORD,dlgStyle:DWORD,iconID:DWORD

    LOCAL mbp:MSGBOXPARAMS

    mov mbp.cbSize, SIZEOF MSGBOXPARAMS
    mov eax, hParent
    mov mbp.hwndOwner, eax
    mov eax, hInstance
    mov mbp.hInstance, eax
    mov eax, lpMsg
    mov mbp.lpszText, eax
    mov eax, lpTitle
    mov mbp.lpszCaption, eax
    mov eax, dlgStyle
    or eax, MB_USERICON
    mov mbp.dwStyle, eax
    mov eax, iconID
    mov mbp.lpszIcon, eax
    mov mbp.dwContextHelpId, NULL
    mov mbp.lpfnMsgBoxCallback, NULL
    mov mbp.dwLanguageId, NULL

    invoke MessageBoxIndirect,ADDR mbp

    ret

MessageBoxI endp

; ¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤=÷=¤
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

bloodhound


Vortex

Hutch, you should add this procedure to masm32.lib :U

hutch--

Erol,

I was supposed to, I just forgot.  ::)
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Vortex

Hutch,

I added the missing hInstance parameter to your procedure :

MessageBoxI PROC hInstance:DWORD,hParent:DWORD,lpMsg:DWORD,lpTitle:DWORD,\
                 dlgStyle:DWORD,iconID:DWORD


Attached is a quick example.

[attachment deleted by admin]

bloodhound


hutch--

Vortex is right, I normally set hInstance as a global but it should properly be self contained so it remains as close as possible to the normal MesageBox API call. I have attached a simple demo on how it works with the minor change.

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php