Hey folks,
i got a little further with my Tab Control, but i have a problem again.
When i select the 2nd Tab it doesn't show the dialog that belongs to it
when i switch back it show the dialog for the 1st one again.
So i think my program doesn't load the second dialog...
Here's the code, with rc
test.asm


.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\gdi32.inc
include \masm32\include\masm32.inc
include \masm32\include\shell32.inc
include \masm32\include\comctl32.inc
include \masm32\include\comdlg32.inc
include \masm32\include\advapi32.inc
include \masm32\include\crypt32.inc


includelib \masm32\lib\shell32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\comctl32.lib
includelib \masm32\lib\comdlg32.lib
includelib \masm32\lib\advapi32.lib
includelib \masm32\lib\crypt32.lib
includelib \masm32\lib\Strmbasd.lib
includelib \masm32\lib\Strmbase.lib

DlgProc PROTO :DWORD,:DWORD,:DWORD,:DWORD

.data

DlgName db "EasyComp",0
Tab1 db "Tab1",0
Tab2 db "Tab2",0
TabTitle1 db "Controls",0
TabTitle2 db "Settings",0
MenuName db "EasyMenu",0
StatusText db "by |TyPhOoN|",0
Text db "Assembling: button.asm",0
Openfiles OFSTRUCT<>
FileName db "\masm32\bin\ml.exe",0
CommandLine db " /nologo /c /coff /Cp \masm32\bin\button.asm",0
FileName2 db "\masm32\bin\link.exe",0
CommandLine2 db " /nologo /SUBSYSTEM:WINDOWS /LIBPATH:c:\masm32\lib \masm32\bin\button.obj",0
processInfo PROCESS_INFORMATION <>
TabStruct TC_ITEM <>
buffer db 512 dup(?)

.data?
hInstance HINSTANCE ?
hWritten dd ?
hInput dd ?
hOutput dd ?
hTab HANDLE ?
hTab1 HANDLE ?
hTab2 HANDLE ?
WhichTabChosen DWORD ?
Handles LABEL DWORD
.const
;<<<<Dialog>>>>
IDC_TAB1 equ 1001
IDC_GROUP equ 1002
IDC_LIST equ 1003

;<<<<ChildDialog>>>>
IDC_EDIT1 equ 2001
IDC_EDIT2 equ 2002
IDC_BROWSE1 equ 2003
IDC_BROWSE2 equ 2004
IDC_APPLY equ 2005
IDC_CHECK1 equ 2006
IDC_CHECK2 equ 2007

IDC_EDIT3 equ 2008
IDC_EDIT4 equ 2009
IDC_EDIT5 equ 2010
IDC_DONE equ 2011

;<<<<Menu>>>>
IDM_REG equ 3001
IDM_EXIT equ 3002
IDM_TASKBAR equ 3003
IDM_HELP equ 3004
IDM_README equ 3005
IDM_ABOUT equ 3006


.code
start:

invoke GetModuleHandle, NULL
mov hInstance, eax
invoke DialogBoxParam, hInstance, ADDR DlgName,NULL, addr DlgProc, NULL
invoke ExitProcess,eax

DlgProc proc hWin :DWORD, uMsg :DWORD, wParam :DWORD, lParam :DWORD
LOCAL startInfo:STARTUPINFO

.IF uMsg==WM_COMMAND
mov eax,wParam
mov edx,wParam
shr edx,16
.IF dx==BN_CLICKED

.IF ax==IDM_EXIT
invoke SendMessage,hWin,WM_CLOSE,0,0
.ELSEIF ax==IDC_APPLY

;invoke GetStdHandle, STD_INPUT_HANDLE
;mov hInput, eax
;invoke GetStdHandle, STD_OUTPUT_HANDLE
;mov hOutput, eax
;invoke WriteConsole,hOutput,addr Text,8,addr hWritten,NULL


invoke GetStartupInfo,ADDR startInfo
mov startInfo.wShowWindow,SW_HIDE
invoke CreateProcess,addr FileName,addr CommandLine,NULL,NULL,FALSE,\
NORMAL_PRIORITY_CLASS,\
NULL,NULL,ADDR startInfo,ADDR processInfo
invoke CloseHandle,processInfo.hThread

invoke CreateProcess,addr FileName2,addr CommandLine2,NULL,NULL,FALSE,\
NORMAL_PRIORITY_CLASS,\
NULL,NULL,ADDR startInfo,ADDR processInfo
invoke CloseHandle,processInfo.hThread
invoke FreeConsole
invoke GetDlgItem,hWin,IDC_LIST
invoke SendMessage,eax,LB_ADDSTRING,NULL,addr Text


.ENDIF

.ENDIF
.ELSEIF uMsg==WM_NOTIFY
mov eax,lParam
mov eax, (NMHDR PTR [eax]).code

.IF eax==TCN_SELCHANGE
mov eax,WhichTabChosen
.IF eax == 0
invoke ShowWindow,hTab1,SW_HIDE
invoke ShowWindow,hTab2,SW_SHOWDEFAULT
mov WhichTabChosen,1

.ELSEIF eax != 0
invoke ShowWindow,hTab2,SW_HIDE
invoke ShowWindow,hTab1,SW_SHOWDEFAULT
mov WhichTabChosen,0

.ENDIF
.ENDIF


.ELSEIF uMsg==WM_INITDIALOG
invoke LoadMenu,hInstance,addr MenuName
invoke SetMenu,hWin,eax



invoke InitCommonControls
invoke GetDlgItem,hWin,IDC_TAB1
mov hTab,eax

mov TabStruct.imask,TCIF_TEXT
mov TabStruct.lpReserved1,0
mov TabStruct.lpReserved2,0
mov TabStruct.pszText,offset TabTitle1
mov TabStruct.cchTextMax,sizeof TabTitle1
mov TabStruct.iImage,0
mov TabStruct.lParam,0
invoke SendMessage,hTab,TCM_INSERTITEM,0,offset TabStruct

mov TabStruct.pszText,offset TabTitle2
mov TabStruct.cchTextMax,sizeof TabTitle2
invoke SendMessage,hTab,TCM_INSERTITEM,1,offset TabStruct

mov eax,offset DlgProc
invoke CreateDialogParam,hInstance,offset Tab1,hTab,eax,0
mov hTab1,eax

mov eax,offset DlgProc
invoke CreateDialogParam,hInstance,offset Tab2,hTab,eax,0
mov hTab2,eax


mov WhichTabChosen,0

invoke ShowWindow,hTab1,SW_SHOWDEFAULT




.ELSEIF uMsg==WM_CLOSE
invoke EndDialog,hWin,NULL

.ENDIF
ret
DlgProc endp
end start

Resource
test.rc

#include "\masm32\include\resource.h"

;<<<<Dialog>>>>
#define IDC_TAB1 1001
#define IDC_GROUP 1002
#define IDC_LIST 1003

;<<<<ChildDialog>>>>
#define IDC_EDIT1 2001
#define IDC_EDIT2 2002
#define IDC_BROWSE1 2003
#define IDC_BROWSE2 2004
#define IDC_APPLY 2005
#define IDC_CHECK1 2006
#define IDC_CHECK2 2007

#define IDC_EDIT3 2008
#define IDC_EDIT4 2009
#define IDC_EDIT5 2010
#define IDC_DONE 2011

;<<<<Menu>>>>
#define IDM_REG 3001
#define IDM_EXIT 3002
#define IDM_TASKBAR 3003
#define IDM_HELP 3004
#define IDM_README 3005
#define IDM_ABOUT 3006

EasyComp DIALOG DISCARDABLE 10, 10, 380, 140
STYLE WS_CAPTION | WS_SYSMENU | WS_POPUP | DS_MODALFRAME
CAPTION "EasyComp v1.02"
FONT 8, "Arial"
BEGIN
CONTROL "Tab1" ,IDC_TAB1, "SysTabControl32", 0x0 ,5,5,180,120
GROUPBOX "Status",IDC_GROUP ,195,5,180,120
LISTBOX IDC_LIST ,200,14,170,115
END
Tab1 DIALOG DISCARDABLE 1, 13, 178, 106
STYLE WS_CHILD
FONT 8, "Arial"
BEGIN
GROUPBOX "Source",100 , 5, 0,166,85
LTEXT "File .asm",200 , 9, 9, 30, 8
LTEXT "File .rc",300 , 9, 21, 30, 8
EDITTEXT IDC_EDIT1 , 40, 8,100,10,ES_AUTOHSCROLL | ES_LEFT
EDITTEXT IDC_EDIT2 , 40, 20,100,10,ES_AUTOHSCROLL | ES_LEFT
DEFPUSHBUTTON "...",IDC_BROWSE1 ,153, 8, 12,10
DEFPUSHBUTTON "...",IDC_BROWSE2 ,153, 20, 12,10
DEFPUSHBUTTON "Start",IDC_APPLY , 74, 91, 30,10
GROUPBOX "Options",400 , 5, 33,166,52
CHECKBOX "Show Console (Recommended)", IDC_CHECK1 , 9, 42,140, 8,BS_AUTOCHECKBOX
GROUPBOX "",500 , 5, 51,166,34
CHECKBOX "Run Executable after Assembly", IDC_CHECK2, 9, 60,140, 8,BS_AUTOCHECKBOX

END

EasyMenu MENU MOVEABLE IMPURE LOADONCALL DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Registry Entries",IDM_REG
MENUITEM SEPARATOR
MENUITEM "&Exit",IDM_EXIT
END
POPUP "&View"
BEGIN
MENUITEM "&Icon in TaskBar",IDM_TASKBAR
END
POPUP "&?"
BEGIN
MENUITEM "&Help",IDM_HELP
MENUITEM "&ReadMe",IDM_README
MENUITEM SEPARATOR
MENUITEM "&About",IDM_ABOUT
END
END
Tab2 DIALOG DISCARDABLE 1, 13, 178, 106
STYLE WS_CHILD
FONT 8, "Arial"
BEGIN
GROUPBOX "Commandlines",600 , 5, 0,166,85
LTEXT "ml",700 , 9, 9, 30, 8
LTEXT "link",800 , 9, 21, 30, 8
LTEXT "rc",900 , 9, 21, 30, 8
EDITTEXT IDC_EDIT3 , 40, 8,100,10,ES_AUTOHSCROLL | ES_LEFT
EDITTEXT IDC_EDIT4 , 40, 20,100,10,ES_AUTOHSCROLL | ES_LEFT
EDITTEXT IDC_EDIT5 , 40, 20,100,10,ES_AUTOHSCROLL | ES_LEFT
DEFPUSHBUTTON "Done",IDC_DONE , 74, 91, 30,10
GROUPBOX "Options",1000 , 5, 33,166,52
;CHECKBOX "Show Console (Recommended)", IDC_CHECK1 , 9, 42,140, 8,BS_AUTOCHECKBOX
GROUPBOX "",1100 , 5, 51,166,34
;CHECKBOX "Run Executable after Assembly", IDC_CHECK2, 9, 60,140, 8,BS_AUTOCHECKBOX
END


thanks in advance, Olli
Posted on 2001-10-29 13:34:58 by Olli
Never mind folks,

i forget to give each dialog a different procedure, i used the same one for all of'em.
If anybody is interested in the new code drop a post or a mail
I'll send it to you

Regards Olli
Posted on 2001-10-29 14:27:58 by Olli