Hi,

I just need a modal dialog box as main window that shows a ListView Control.
But the DialogBoxParam is always returning -1.
I really don?t know where is my error.

The code is imcomplete, but the WM_INITDIALOG message never reach my Dialog Procedure!

I tried every kind of ListView styles using Resource Hacker and doesn't worked! :(

PLEASE, I NEED HELP.




// RESOURCE
#define IDC_LSV1 1002

#include "/masm32/include/resource.h"

OPCODE DIALOGEX 6,6,241,150

CAPTION "Testing Resources"
FONT 8,"Tahoma"
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU

BEGIN
CONTROL "",IDC_LSV1,"SysListView32", LVS_SINGLESEL | LVS_NOSORTHEADER |
LVS_SHOWSELALWAYS | LVS_REPORT | WS_TABSTOP, 6, 7, 230, 118
END





.386
.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\gdi32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib

IDC_LSV1 equ 1002

DlgProc proto :DWORD,:DWORD,:DWORD,:DWORD

;==================================
; DATA
;==================================
.data
DialogName db "OPCODE", 0
DebugError db "DialogBoxParam returned -1!", 0
DebugMsg db "WM_INITDIALOG message!", 0

;==================================
; CODE
;==================================
.code
start:
invoke GetModuleHandle, NULL
invoke DialogBoxParam, eax, addr DialogName, NULL, ADDR DlgProc, 0
.if eax == -1
invoke MessageBox, NULL, addr DebugError, addr DialogName, MB_OK
.endif
invoke ExitProcess, 0

;==================================
; DIALOG PROCEDURE
;==================================
DlgProc proc hDlg:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD

.if uMsg==WM_INITDIALOG
invoke MessageBox, NULL, addr DebugMsg, addr DialogName, MB_OK
.elseif uMsg==WM_CLOSE
invoke EndDialog, hDlg, 0
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
DlgProc endp

end start

Posted on 2004-02-03 06:29:30 by Opcode
You need to call InitCommonControls() before the dialog will work.

Nick
Posted on 2004-02-03 06:34:35 by Nick
Now it work's !!!!

Thanks a lot, Nick!!! :alright:
Posted on 2004-02-03 06:42:49 by Opcode