.386 .model flat,stdcall option casemap:none include windows.inc include user32.inc include kernel32.inc include gdi32.inc includelib user32.lib includelib kernel32.lib includelib gdi32.lib DlgProc proto :DWORD,:DWORD,:DWORD,:DWORD .data caption db "About",0 message db "How to apply a complex",13,10,"region to a simple",13,10,"dialog box.",0 .data? hInstance dd ? hResInfo dd ? hResData dd ? pRsrc dd ? sizeRsrc dd ? brush dd ? .code start: invoke GetModuleHandle, NULL mov hInstance,eax invoke DialogBoxParam, hInstance, 1001, NULL, addr DlgProc, NULL invoke ExitProcess,0 DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM .if uMsg == WM_INITDIALOG invoke SetWindowPos,hWnd, HWND_TOPMOST,0,0,0,0,SWP_NOACTIVATE + SWP_NOMOVE + SWP_NOSIZE invoke LoadBitmap,hInstance,2001 invoke CreatePatternBrush,eax mov brush, eax invoke FindResource,hInstance,2002,RT_RCDATA mov hResInfo,eax invoke LoadResource,hInstance,hResInfo mov hResData, eax invoke SizeofResource,hInstance,hResInfo mov sizeRsrc,eax invoke LockResource,hResData mov pRsrc, eax invoke ExtCreateRegion,NULL,sizeRsrc,pRsrc invoke SetWindowRgn,hWnd,eax,TRUE .elseif uMsg==WM_CTLCOLORDLG mov eax, brush ret .elseif uMsg==WM_COMMAND mov eax,wParam .if eax==1002 invoke MessageBox,hWnd,addr message,addr caption,MB_ICONASTERISK .endif .elseif uMsg==WM_LBUTTONDBLCLK invoke SendMessage,hWnd,WM_CLOSE,0,0 .elseif uMsg==WM_LBUTTONDOWN invoke SendMessage,hWnd,WM_NCLBUTTONDOWN,HTCAPTION,lParam .elseif uMsg == WM_CLOSE invoke DeleteObject,brush invoke EndDialog, hWnd, 0 .endif xor eax,eax ret DlgProc endp end start