Hello all!
Im having some trouble with my resource script..
heres the code im using:


;---------------------------------------------------------------
; resoucre file
;---------------------------------------------------------------
#include "/asm/resource.h"

; data
#define IDC_Sdata 10001

#define IDC_Svagn1D 10101
#define IDC_SAchk1 10102
#define IDC_Smassa1 10103
#define IDC_Slangd1 10104

#define IDC_Sst1 10105
#define IDC_Skg1 10106
#define IDC_Sm1 10107

#define IDC_st1 10108
#define IDC_kg1 10109
#define IDC_m1 10110

#define IDC_delare 10002

#define IDC_Svagn2D 10201
#define IDC_SAchk2 10202
#define IDC_Smassa2 10203
#define IDC_Slangd2 10204

#define IDC_Sst2 10205
#define IDC_Skg2 10206
#define IDC_Sm2 10207

#define IDC_st2 10208
#define IDC_kg2 10209
#define IDC_m2 10210

Dialogen DIALOGEX 10, 10, 320, 110
CAPTION "PrjArb GUIsheisse"
FONT 8,"MS Sans Serif"
CLASS "dlgklass"
STYLE 0x10CF0000
EXSTYLE 0x00000000
BEGIN
CONTROL "Data",IDC_Sdata,"Button",0x50000007,10,10,300,90,0x00000000

CONTROL "Vagn 1 (com 1)",IDC_Svagn1D,"Static",0x50000000,50,20,50,10,0x00000000
CONTROL "Antal checks",IDC_SAchk1,"Static",0x50000000,20,40,60,10,0x00000000
CONTROL "Massa",IDC_Smassa1,"Static",0x50000000,20,55,60,10,0x00000000
CONTROL "L?ngd",IDC_Slangd1,"Static",0x50000000,20,70,60,10,0x00000000

CONTROL "st",IDC_Sst1,"Static",0x50000000,115,40,15,10,0x00000000
CONTROL "kg",IDC_Skg1,"Static",0x50000000,115,55,15,10,0x00000000
CONTROL "m",IDC_Sm1,"Static",0x50000000,115,70,15,10,0x00000000

CONTROL "",IDC_st1,"Edit",0x50810000,80,40,30,10,0x00000000
CONTROL "",IDC_kg1,"Edit",0x50810000,80,55,30,10,0x00000000
CONTROL "",IDC_m1,"Edit",0x50810000,80,70,30,10,0x00000000

CONTROL "",IDC_delare,"ReBarWindow32",0x50000000,147,20,6,70,0x00000000

CONTROL "Vagn 2 (com 2)",IDC_Svagn2D,"Static",0x58000000,200,20,50,10,0x00000000

CONTROL "Antal checks",IDC_SAchk2,"Static",0x58000000,170,40,60,10,0x00000000
CONTROL "Massa",IDC_Smassa2,"Static",0x58000000,170,55,60,10,0x00000000
CONTROL "L?ngd",IDC_Slangd2,"Static",0x58000000,170,70,60,10,0x00000000

CONTROL "st",IDC_Sst2,"Static",0x58000000,265,40,15,10,0x00000000
CONTROL "kg",IDC_Skg2,"Static",0x58000000,265,55,15,10,0x00000000
CONTROL "m",IDC_Sm2,"Static",0x58000000,265,70,15,10,0x00000000

CONTROL "",IDC_st2,"Edit",0x58810000,230,40,30,10,0x00000000
CONTROL "",IDC_kg2,"Edit",0x58810000,230,55,30,10,0x00000000
CONTROL "",IDC_m2,"Edit",0x58810000,230,70,30,10,0x00000000
END
;---------------------------------------------------------------
; EOF
;---------------------------------------------------------------

;---------------------------------------------------------------
; proggy.asm
;---------------------------------------------------------------
.386
.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc

include \masm32\include\kernel32.inc
include \masm32\include\user32.inc

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

WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD

.data
HdlgC db 'dlgklass',0
HdlgN db 'Dialogen',0

.data?
programHT HINSTANCE ?
CmdLn LPSTR ?

.code
start_mf:
invoke GetModuleHandle,NULL
mov programHT,eax
invoke GetCommandLine
mov CmdLn,eax
invoke WinMain,programHT,NULL,CmdLn,SW_SHOWDEFAULT
invoke ExitProcess,eax

WinMain proc pHT:HINSTANCE,prevpHT,cmdln:LPSTR,showStyle:DWORD
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
LOCAL hDlg:HWND

mov wc.cbSize,sizeof WNDCLASSEX
mov wc.style,CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc,WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,DLGWINDOWEXTRA
push pHT
pop wc.hInstance
invoke LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
mov wc.hbrBackground,COLOR_BTNFACE+1
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,offset HdlgC
invoke RegisterClassEx,addr wc
invoke CreateDialogParam,programHT,addr HdlgN,NULL,addr WndProc,NULL
mov hDlg,eax
invoke ShowWindow,hDlg,SW_SHOWNORMAL
invoke UpdateWindow,hDlg
messageloop:
invoke GetMessage,addr msg,NULL,0,0
cmp eax,0
je exitdisshit
invoke TranslateMessage,addr msg
invoke DispatchMessage,addr msg
jmp messageloop
exitdisshit:
mov eax,msg.wParam
ret
WinMain endp

WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM

cmp uMsg,WM_DESTROY
jne chk_blah
invoke PostQuitMessage,NULL
jmp die_bitch_die

chk_blah:
cmp uMsg,WM_COMMAND
jne rerun
...

rerun:
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret

die_bitch_die:
xor eax,eax
ret
WndProc endp
end start_mf
;---------------------------------------------------------------
; EOF
;---------------------------------------------------------------

The problem is that nothing is shown... another problem is that quits almost immediatly (wndproc runs seven times then it quits), it was working with another resource script using DIALOG instead of DIALOGEX. What is the diffrence between the two, and how can i make this work :confused:?
Posted on 2004-03-01 12:07:40 by sluggo
You should invoke InitCommonControls/InitCommonControlsEx first
Posted on 2004-03-02 04:22:37 by Morris
tried that but it didnt work =(..
Posted on 2004-03-02 05:23:57 by sluggo
Your resource file uses ReBar control, so you shoud call InitCommonControlsEx with ICC_COOL_CLASSES flag.
Example:
.data
...
comCtrls INITCOMMONCONTROLSEX <0>

.code

start:
mov comCtrls.dwSize, sizeof comCtrls
mov comCtrls.dwICC, ICC_COOL_CLASSES
invoke InitCommonControlsEx, OFFSET comCtrls
...

I was check your code and add above code. It run fine.
Best regards
Posted on 2004-03-03 00:24:14 by TQN
Your resource file uses ReBar control, so you shoud call InitCommonControlsEx with ICC_COOL_CLASSES flag.
Example:
.data
...
comCtrls INITCOMMONCONTROLSEX <0>

.code

start:
mov comCtrls.dwSize, sizeof comCtrls
mov comCtrls.dwICC, ICC_COOL_CLASSES
invoke InitCommonControlsEx, OFFSET comCtrls
...

Good luck
Posted on 2004-03-03 00:24:16 by TQN
Thank you! Thank you! Thank you! :alright:
Thank you TQN!! works splendidly!
Posted on 2004-03-03 15:13:30 by sluggo