News:

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

DialogBoxParam error.

Started by LechooY, October 31, 2006, 06:31:54 PM

Previous topic - Next topic

LechooY

.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...

remus2k

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



LechooY

#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?

remus2k

.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

LechooY

invoke InitCommonControls

Heh that little mistake  :bdg

Thanks remus2k!