Forum
|
|
Snippets forum rulesIn this forum all the registered users may post their snippets of code they whish to share with the WinAsm Studio community following these basic rules:
* Only snippets of code are accepted in the topics of this forum.
* Discussions, suggestions, requests etc. must be posted in the "Discussions" topic.
* Do not post copyrighted material.
Administrators/moderators may edit, move or delete the entries that do not follow the preceding rules.
MessageBox with a custom icon, a code snippet that allows you to display a message box with any icon of your choice.
|
Jupiter |
|
Extremely Active Member
Group: Moderators
Posts: 738
Member No.: 773
Joined: 10-November 04
|
CODE | MsgBox Proto hWndM:HWND, sMsgTxt:LPSTR, sCaption:LPSTR, dStyle:DWORD, dIcon:DWORD
MessageBox Show MessageBox with custom icon Syntax: MsgBox Proto hWndM:HWND, sMsgTxt:LPSTR, sCaption:LPSTR, dStyle:DWORD, dIcon:DWORD Parameters: [IN] HWND hWndM - Main HWND [IN] LPSTR sMsgTxt - Message to display [IN] LPSTR sCaption - Message Caption [IN] DWORD dStyle - Style, standard MessageBox constants [IN] DWORD dIcon - Icon ID Returns: MessageBoxIndirect return value Example: invoke MsgBox, hWnd, addr szAboutApp, addr szAboutCap, MB_OK, IDI_MAIN |
See attachment:
Attached File ( Number of downloads: 193 )
Login or Register to download
|
|
|
|
0x3a |
|
New Member
Group: Members
Posts: 6
Member No.: 30940
Joined: 14-January 10
|
Doesn't seem to work, when I do 0 for the hIcon it does work, but whenever I do for example IDI_ICON which is a constant equ 100 nothing happends anymore..
|
|
|
|
0x3a |
|
New Member
Group: Members
Posts: 6
Member No.: 30940
Joined: 14-January 10
|
Yes I am loading the icon as well, using:
CODE | invoke LoadIcon,hInstance,IDI_ICON |
This happends in my main dialog handler, after that I use an about button like so:
CODE | .if eax==IDI_BUTTONABOUT invoke MsgBox,0, addr g_AboutInfo, addr g_AboutTitle, MB_OK,IDI_ICON; .endif |
But with IDI_ICON it doesn't work, when I just place a 0 there it skips the custom icon and just shows a normal popup.
|
|
|
|
0x3a |
|
New Member
Group: Members
Posts: 6
Member No.: 30940
Joined: 14-January 10
|
I fixed it, this works for me:
CODE | ; ------------------------------------------------------ ; Name: MsgBox ; Desc: Show a messagebox with a custom icon
MsgBox Proc hWndM:HWND, sMsgTxt:LPSTR, sCaption:LPSTR, dStyle:DWORD, dIcon:DWORD Local MsgBoxP :MSGBOXPARAMS Ifdef TranspWnd .If VerInfo.dwMajorVersion >= 5 invoke SetWndTransp, hWndM, TR_INACTIVE .EndIf EndIf push edi lea edi, MsgBoxP assume edi: ptr MSGBOXPARAMS mov [edi].cbSize, sizeof MSGBOXPARAMS mov [edi].hwndOwner, 0 m2m [edi].hInstance, hInstance m2m [edi].lpszText, sMsgTxt m2m [edi].lpszCaption, sCaption mov [edi].dwStyle, MB_OK or MB_USERICON m2m [edi].lpszIcon, dIcon assume edi: nothing invoke MessageBoxIndirect, edi pop edi Done: Ifdef TranspWnd .If VerInfo.dwMajorVersion >= 5 push eax invoke SetWndTransp, hWndMain, TR_ACTIVE pop eax .EndIf EndIf ret MsgBox EndP |
For anyone who has the same problems
|
|
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
|
|
|