The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: LechooY on October 31, 2006, 06:31:54 PM

Title: DialogBoxParam error.
Post by: LechooY on October 31, 2006, 06:31:54 PM
.386
.model flat, stdcall
option casemap :none

include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\advapi32.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\advapi32.lib
 

.DATA
Test1 DB 'Test',0

.DATA?
hInstance DD ?
CommandLine DD ?
hProgress1 DD ?
DLGWin DD ?


.CODE

Start:
invoke GetModuleHandle, 0
mov hInstance, eax
invoke GetCommandLine
mov CommandLine, eax

mov eax, offset InstallProc
invoke DialogBoxParam, hInstance, 1000, 0, eax, 0

Exit_Program:
invoke ExitProcess, 0


InstallProc proc STDCALL uses ebx edi esi, hWin:DWORD, wmsg:DWORD, _wparam:DWORD, _lparam:DWORD
.if wmsg == WM_DESTROY || wmsg == WM_CLOSE
invoke MessageBox, 0, addr Test1, addr Test1, MB_OK
invoke EndDialog, hWin, 0
invoke PostQuitMessage, 0
.elseif wmsg == WM_INITDIALOG
mov eax, hWin
mov DLGWin, eax
invoke GetDlgItem, hWin, 1004
mov hProgress1, eax
.else
sub eax,eax
.endif
ret
InstallProc endp

End Start


Hello.

I have problem with DialogBoxParam. I using RadASM (IT'S GREAT) to create dialog (ID : 1000). When I have show then show message 'Test' and exit program. Why? I try everything...
Title: Re: DialogBoxParam error.
Post by: remus2k on October 31, 2006, 07:01:15 PM
hi

what you correctly problem ?

InstallProc proc STDCALL uses ebx edi esi, hWin:DWORD, wmsg:DWORD, _wparam:DWORD, _lparam:DWORD
.if wmsg == WM_DESTROY || wmsg == WM_CLOSE
invoke MessageBox, 0, addr Test1, addr Test1, MB_OK
;invoke EndDialog, hWin, 0
invoke ExitProcess, 0
.elseif wmsg == WM_INITDIALOG
mov eax, hWin
mov DLGWin, eax
invoke GetDlgItem, hWin, 1004
mov hProgress1, eax
.else
sub eax,eax
.endif
ret
InstallProc endp


Title: Re: DialogBoxParam error.
Post by: LechooY on October 31, 2006, 07:28:40 PM
#define IDD_INSTALL 1000
#define IDC_ROGRESS 1004
IDD_INSTALL DIALOGEX 449,380,216,64
CAPTION "Setup"
FONT 8,"MS Sans Serif",400,0
STYLE 0x10C70000
EXSTYLE 0x00000008
BEGIN

  CONTROL "",IDC_ROGRESS,"msctls_progress32",0x50000000,36,46,122,11,0x00000000
END


Problem is that Dialog box is not show only application is momentarily closed. Why Dialog not show?
Title: Re: DialogBoxParam error.
Post by: remus2k on October 31, 2006, 07:40:15 PM
.386
.model flat, stdcall
option casemap :none

include windows.inc
include user32.inc
include kernel32.inc
include comdlg32.inc
include Comctl32.inc
include shell32.inc
include advapi32.inc
include gdi32.inc

includelib user32.lib
includelib kernel32.lib
includelib comdlg32.lib
includelib Comctl32.lib
includelib shell32.lib
includelib advapi32.lib
includelib gdi32.lib
.const

.DATA
Test1 DB 'Test',0

.DATA?
hInstance DD ?
CommandLine DD ?
hProgress1 DD ?
DLGWin DD ?


.CODE

Start:
invoke GetModuleHandle, 0
mov hInstance, eax
invoke GetCommandLine
mov CommandLine, eax
invoke InitCommonControls
mov eax, offset InstallProc
invoke DialogBoxParam, hInstance, 1000, 0, eax, 0

Exit_Program:
invoke ExitProcess, 0


InstallProc proc STDCALL uses ebx edi esi, hWin:DWORD, wmsg:DWORD, _wparam:DWORD, _lparam:DWORD
.if wmsg == WM_DESTROY || wmsg == WM_CLOSE
;invoke MessageBox, 0, addr Test1, addr Test1, MB_OK
invoke EndDialog, hWin, 0
invoke PostQuitMessage, 0
.elseif wmsg == WM_INITDIALOG
mov eax, hWin
mov DLGWin, eax
invoke GetDlgItem, hWin, 1004
mov hProgress1, eax
.else
sub eax,eax
.endif
ret
InstallProc endp

End Start
Title: Re: DialogBoxParam error.
Post by: LechooY on October 31, 2006, 08:12:57 PM
invoke InitCommonControls

Heh that little mistake  :bdg

Thanks remus2k!