The MASM Forum Archive 2004 to 2012

Project Support Forums => GoAsm Assembler and Tools => Topic started by: Vortex on July 12, 2007, 05:11:34 PM

Title: Customizing message boxes
Post by: Vortex on July 12, 2007, 05:11:34 PM
Here is an example of a message box displaying a customized button. The demo is based on the article :

http://www.catch22.net/tuts/msgbox.asp


#include "CustMsgBox.inc"

.data
msg1 db 'This is a customized message box',0
capt db 'Hello!',0
buttontext db 'Click here',0
hMboxHook dd ?
pButtonText dd ?

.code

start:

invoke CustomMsgBox,0,ADDR msg1,ADDR capt,ADDR buttontext
invoke ExitProcess,0

mboxCBTProc FRAME nCode,wParam,lParam

cmp d[nCode],0
jb >
cmp d[nCode],HCBT_ACTIVATE
jne >
invoke GetDlgItem,[wParam],IDOK
invoke SetWindowText,eax,[pButtonText]
xor eax,eax
ret
:
invoke CallNextHookEx,[hMboxHook],[nCode],[wParam],[lParam]
ret
ENDF

CustomMsgBox FRAME hWnd,message,caption,buttontext

mov eax,[buttontext]
mov [pButtonText],eax
invoke GetCurrentThreadId
invoke SetWindowsHookEx,WH_CBT,ADDR mboxCBTProc,NULL,eax
mov [hMboxHook],eax
invoke MessageBox,0,[message],[caption],MB_OK
invoke UnhookWindowsHookEx,[hMboxHook]
ret
ENDF



[attachment deleted by admin]
Title: Re: Customizing message boxes
Post by: Vortex on December 12, 2008, 07:23:32 PM
Here is the GoAsm version of the demo where the message box is moved to a thread.

[attachment deleted by admin]
Title: Re: Customizing message boxes
Post by: jorgon on December 13, 2008, 10:45:48 AM
Great stuff Vortex - thanks!

Title: Re: Customizing message boxes
Post by: Vortex on October 16, 2011, 09:50:18 AM
Simplified code to detect the message box.