Hi! everyone :)
well the TAB Dialog Based is Runing , I can
Draw How much Tabs us i want BUT ..
in the recource file there is a MainDialog
and then more to DialogChild each one with a button1 and Dialog2Child button2 this child dialog?s are in in the TAB CONTROL, well
when i click to change to the other TAB position
it works but the button is the button1...
and in the childDialog2 is button2 .. strange :(
so i conclude that the metod to change TAB does not work.. WELL I HAVE TAKEN FROM LATIGO TUTORIAL
...
Please Help me !heheh

*********************************************
HERE IS THE CODE
*********************************************
;*******************************************
;THANKS LATIGO ! FOR THE TUTORIAL
;*******************************************
;WIN32 functions used in this aplication
;*******************************************

extern SetMenu
extern SendMessageA
extern LoadMenuA
extern GetModuleHandleA
extern ExitProcess
extern DialogBoxParamA
extern CreateDialogParamA
extern MessageBoxA
extern EndDialog
extern SendDlgItemMessageA
extern GetOpenFileNamePreview
import GetOpenFileNamePreview MSVFW32.DLL
extern InitCommonControls
extern GetDlgItem
extern ShowWindow


;******************************************
; INC?s TO include
;******************************************

%include '\lab\vasm\inc\win32n.inc'
%include '\lab\vasm\inc\nagoa.inc'





Instance dd 0
hInst dd 0
WhichTabChosen dw 0
hwndTab dd 0
ItemStruct resb TC_ITEM_size
TabTitle1 DB "First Tab",0
TabTitle2 DB "Second Tab",0
;----------------------------
Handles
Child1hWnd dw 0
Child2hWnd dw 0
;----------------------------
srtNMHDR resb NMHDR_size
info1 db "Dialog 1",0
info2 db "Dialog 2",0
title1 db "debug message",0

;*********************************************


..start:

enter 0,0
call GetModuleHandleA, NULL
mov , eax
call WinMain, ,NULL,SW_SHOWDEFAULT
xor eax,eax
leave
ret 16


WinMain :
%define hInst ebp+8
%define hPrevInst ebp+12
%define CmdShow ebp+16
call DialogBoxParamA , , 1000, 0, @Dialog1Proc, 0
xor eax,eax
leave
ret 16


;********************************************

@Dialog1Proc:

%define hdlg1 ebp+8
%define dlg1msg ebp+12
%define wparam ebp+16
%define lparam ebp+20

enter 0,0
cmp dword ,WM_NOTIFY
je near notify
cmp dword ,WM_INITDIALOG
je wminitdialog
cmp dword ,WM_COMMAND
je near wmcommand
;cmp dword ,WM_PAINT
;je near Paint
cmp dword ,WM_CLOSE
je near wmclose
jmp unhandled


;--------------
unhandled:

mov eax,0
leave
ret 16

;--------------
wminitdialog:

call InitCommonControls
call GetDlgItem,,1011 ; IDC_TAB1 We get the handle to the Tab Control
mov ,EAX ; Lets keep it in hwndTab


MOV dword ,TCIF_TEXT ; Text? image? what do you want?
MOV dword ,0 ; Reserved
MOV dword ,0 ; Reserved
MOV dword ,TabTitle1 ; pointer to string containing tab text
MOV dword ,0ah ; index to tab control's image
MOV dword ,0 ; Extra info
call SendMessageA,,TCM_INSERTITEM,0,ItemStruct

; Now we add the second Tab title
MOV dword ,TabTitle2
MOV dword ,0ah
call SendMessageA,,TCM_INSERTITEM,1, ItemStruct

; Now we add the thirth Tab title .... etc..
;MOV dword ,TabTitle3
;MOV dword ,0ah
;call SendMessageA,,TCM_INSERTITEM,2, ItemStruct


call CreateDialogParamA , , 1001, , @Dialog2Proc, 0
mov ,eax
call CreateDialogParamA , , 1002, , @Dialog3Proc, 0
mov ,eax

mov dword ,0 ;lets initialize var with zero

call ShowWindow , , SW_SHOWDEFAULT ; the first is shown




;->set the menu

; call LoadMenuA,,ID_MENU ; ID_MENU equ Number in the resource file..

; call SetMenu,,eax ; eax ptIDMenu

;your code here... if needed... ;)

mov eax,1
leave
ret 16

;--------------
wmcommand:
;cmp dword , ...
;je near New1
;cmp dword , ...
;jmp near New2


;change the above to feet your code...


mov eax,1
ret 16

;-------------
New1:
call MessageBoxA , ,Handles,title1,MB_OK ; just for tracking...
jmp unhandled
;-------------
New2:
call MessageBoxA , ,Handles,title1,MB_OK ; just for tracking...
jmp unhandled
;-------------
wmclose:

call ExitProcess,0

ret16

;------------

;====== NOTIFY==TAB MESSAGE===

notify:
mov eax ,
mov eax,
; WM_NOTIFY has 2 messages lparam+4 is the first message , lparam+4+4 is second.
cmp eax,TCN_SELCHANGE
je ChangingTab
;jmp near unhandled
leave
retn 16


ChangingTab:

MOV EBX,
MOV EAX,
; So we load in EAX the handle belonging to the current dialogbox

call ShowWindow,EAX,SW_HIDE
; and we hide it damn it!

call SendMessageA,,TCM_GETCURSEL,0,0
; I now send a TCM_GETCURSEL message which will return in EAX the tab which is being
; selected.

MOV ,EAX
; Lets update the flag
MOV EBX,dword
; Now lets retrieve the handle of the dialog box that belongs to the chosen tab.

call ShowWindow,EBX,SW_SHOWDEFAULT
; and now lets show it :)
;jmp near unhandled
leave
retn 16
;====== NOTIFY==TAB MESSAG===END












;--2Dialog----child--one------------


;*********************************************
; 2DialogWndProc hwnd:DWORD, wmsg:DWORD, wparam:DWORD, lparam:DWORD
; ebp+8 ebp+12 ebp+16 ebp+20
; it?s allways like this !
;**********************************************

@Dialog2Proc:

%define hdlg2 ebp+8
%define dlg2msg ebp+12
%define wparam2 ebp+16
%define lparam2 ebp+20

enter 0,0
cmp dword ,WM_NOTIFY
je near notify
cmp dword ,WM_INITDIALOG
je wminitdialog2
cmp dword ,WM_COMMAND
je near wmcommand2
;cmp dword ,WM_PAINT
;je near Paint2
;cmp dword ,WM_CLOSE
;je near wmclose
jmp near unhandled




;--------------
unhandled2:

mov eax,0 ;return false see win32api.hlp
leave
ret 16

;--------------
wminitdialog2:

;->set the menu

; call LoadMenuA,,ID_MENU ; ID_MENU equ Number in the resource file..

; call SetMenu,,eax ; eax ptIDMenu

;your code here... if needed... ;)

mov eax,1
leave
ret 16

;--------------
wmcommand2:
cmp dword , 101 ; IDC_BUTTON1
je near New1
;cmp dword , ID_.....
;jmp near New2


;change the above to feet your code...


mov eax,1
ret 16


;--3Dialog-------------child one------------------------------------------


;**********************************************
; 3DialogWndProc hwnd:DWORD, wmsg:DWORD, wparam:DWORD, lparam:DWORD
; ebp+8 ebp+12 ebp+16 ebp+20
; it?s allways like this !
;**********************************************

@Dialog3Proc:
%define hdlg3 ebp+8
%define dlg3msg ebp+12
%define wparam3 ebp+16
%define lparam3 ebp+20

enter 0,0
cmp dword ,WM_NOTIFY
je near notify
cmp dword ,WM_INITDIALOG
je wminitdialog3
cmp dword ,WM_COMMAND
je near wmcommand3
;cmp dword ,WM_PAINT
;je near Paint3
;cmp dword ,WM_CLOSE
;je near wmclose
jmp near unhandled
;--------------
wminitdialog3:

;->set the menu

; call LoadMenuA,,ID_MENU ; ID_MENU equ Number in the resource file..

; call SetMenu,,eax ; eax ptIDMenu

;your code here... if needed... ;)

mov eax,1
leave
ret 16

;--------------
wmcommand3:
cmp dword , 102 ; IDC_BUTTON2
je near New1
;cmp dword , ID_ ....
;jmp near New2


;change the above to feet your code...


mov eax,1
ret 16
Posted on 2001-08-18 20:30:21 by Nguga
;ITS WORKING TAB DIALOG NASM
;******************************************
; Written by ->Nguga TAB DIALOG made in NaGoA ; ;*******************************************
;THANKS LATIGO ! FOR THE TUTORIAL
;*******************************************
;WIN32 functions used in this aplication
;*******************************************

extern SetMenu
extern SendMessageA
extern LoadMenuA
extern GetModuleHandleA
extern ExitProcess
extern DialogBoxParamA
extern CreateDialogParamA
extern MessageBoxA
extern EndDialog
extern SendDlgItemMessageA
extern GetOpenFileNamePreview
import GetOpenFileNamePreview MSVFW32.DLL
extern InitCommonControls
extern GetDlgItem
extern ShowWindow


;******************************************
; INC?s TO include
;******************************************

%include '\lab\vasm\inc\win32n.inc'
%include '\lab\vasm\inc\nagoa.inc'




opfNameYouWant:
ISTRUC OPENFILENAME
AT OPENFILENAME.lStructSize, DD OPENFILENAME_size
AT OPENFILENAME.hWndOwner, DD 0
AT OPENFILENAME.hInstance, DD 0
AT OPENFILENAME.lpstrFilter, DD FiltroFile
AT OPENFILENAME.lpstrCustomFilter, DD 0
AT OPENFILENAME.nMaxCustFilter, DD 0
AT OPENFILENAME.nFilterIndex, DD 0
AT OPENFILENAME.lpstrFile, DD BufferForFile
AT OPENFILENAME.nMaxFile, DD nmaxfile
AT OPENFILENAME.lpstrFileTitle, DD 0
AT OPENFILENAME.nMaxFileTitle, DD 0
AT OPENFILENAME.lpstrInitialDir, DD 0
AT OPENFILENAME.lpstrTitle, DD Titulo
AT OPENFILENAME.Flags, DD OFN_LONGNAMES | OFN_EXPLORER
AT OPENFILENAME.nFileOffset, DW 0
AT OPENFILENAME.nFileExtension, DW 0
AT OPENFILENAME.lpstrDefExt, DD 0
AT OPENFILENAME.lCustData, DD 0
AT OPENFILENAME.lpfnHook, DD 0
AT OPENFILENAME.lpTemplateName, DD 0
IEND

BufferForFile RESD 260
FiltroFile DB 'TXT',0,'*.txt',0,0 ;cxhange to your needs...
nmaxfile EQU 256
Titulo db 'ola!',0
Instance dd 0
hInst dd 0
TABCHOSE dd 0
hwndTab dd 0
ItemStruct resb TC_ITEM_size
TabTitle1 DB "First Tab",0
TabTitle2 DB "Second Tab",0 ; Pretty much speak for themselves dont they?
;----------------------------
Handles:
Child1hWnd dd 0
Child2hWnd dd 0
;----------------------------
srtNMHDR resb NMHDR_size
info1 db "Dialog 1",0
info2 db "Dialog 2",0
title1 db "debug message",0

;*****************************************************************


..start:

enter 0,0
call GetModuleHandleA, NULL
mov , eax
call WinMain, ,NULL,SW_SHOWDEFAULT
xor eax,eax
leave
ret 16


WinMain :
%define hInst ebp+8
%define hPrevInst ebp+12
%define CmdShow ebp+16
call DialogBoxParamA , , 1000, 0, @Dialog1Proc, 0

xor eax,eax
leave
ret 16


;*****************************************************************

@Dialog1Proc:

%define hdlg1 ebp+8 ;hwnd ... like this name better :)
%define dlg1msg ebp+12 ;wmsg ... like this name better :)
%define wparam ebp+16
%define lparam ebp+20

enter 0,0
cmp dword ,WM_NOTIFY
je near notify
cmp dword ,WM_INITDIALOG
je wminitdialog
cmp dword ,WM_COMMAND
je near wmcommand
;cmp dword ,WM_PAINT
;je near Paint
cmp dword ,WM_CLOSE
je near wmclose
jmp unhandled


;--------------
unhandled:

mov eax,0 ;return false see win32api.hlp
leave
ret 16

;--------------
wminitdialog:

call InitCommonControls ; we've got to justify comctl32.dll!
call GetDlgItem,,1011 ; IDC_TAB1 We get the handle to the Tab Control
mov ,EAX ; Lets keep it in hwndTab


MOV dword ,TCIF_TEXT ; Text? image? what do you want?
MOV dword ,0 ; Reserved
MOV dword ,0 ; Reserved
MOV dword ,TabTitle1 ; pointer to string containing tab text
MOV dword ,0ah
MOV dword ,0 ; index to tab control's image
MOV dword ,0 ; Extra info

call SendMessageA,,TCM_INSERTITEM,0,ItemStruct

; Now we add the second Tab title
MOV dword ,TabTitle2
MOV dword ,0bh
call SendMessageA,,TCM_INSERTITEM,1, ItemStruct

; Now we add the thirth Tab title .... etc..
;MOV dword ,TabTitle3
;MOV dword ,0ah
;call SendMessageA,,TCM_INSERTITEM,2, ItemStruct


call CreateDialogParamA , , 1001, , @Dialog2Proc, 0
mov ,eax

call CreateDialogParamA , , 1002, , @Dialog3Proc, 0
mov ,eax

mov dword ,0 ;lets initialize var with zero

call ShowWindow , , SW_SHOWDEFAULT ; the first is shown




;->set the menu

; call LoadMenuA,,ID_MENU ; ID_MENU equ Number in the resource file..

; call SetMenu,,eax ; eax ptIDMenu

;your code here... if needed... ;)

mov eax,1
leave
ret 16

;--------------
wmcommand:
;cmp dword , 1001
;je near New1
;cmp dword , 1002
;jmp near New2


;change the above to feet your code...


mov eax,1
ret 16

;-------------
New1:
call MessageBoxA , ,info1,title1,MB_OK
jmp unhandled
;-------------
New2:
call MessageBoxA , ,info2,title1,MB_OK
jmp unhandled
;-------------
wmclose:

call ExitProcess,0

ret16

;------------

;====== NOTIFY==TAB MESSAGE===

notify:
mov eax ,
mov eax,
; WM_NOTIFY has 2 messages lparam+4 is the first message , lparam+4+4 is second.
cmp eax,TCN_SELCHANGE
je ChangingTab
;jmp near unhandled
leave
retn 16


ChangingTab:

MOV EBX,
MOV EAX,
; So we load in EAX the handle belonging to the current dialogbox

call ShowWindow,EAX,SW_HIDE
; and we hide it damn it!

call SendMessageA,,TCM_GETCURSEL,0,0
; I now send a TCM_GETCURSEL message which will return in EAX the tab which is being
; selected.

MOV ,EAX
; Lets update the flag
MOV EBX,dword
; Now lets retrieve the handle of the dialog box that belongs to the chosen tab.

call ShowWindow,EBX,SW_SHOWDEFAULT
; and now lets show it :)
;jmp near unhandled
leave
retn 16
;====== NOTIFY==TAB MESSAG===END





;--2Dialog--------------------------child one------------------------------------------


;*****************************************************************
; 2DialogWndProc hwnd:DWORD, wmsg:DWORD, wparam:DWORD, lparam:DWORD
; ebp+8 ebp+12 ebp+16 ebp+20
; it?s allways like this !
;*****************************************************************

@Dialog2Proc: ;change to your name to this Dialog... or keep if you like the name.. :)

%define hdlg2 ebp+8 ;hwnd ... like this name better :)
%define dlg2msg ebp+12 ;wmsg ... like this name better :)
%define wparam2 ebp+16
%define lparam2 ebp+20

enter 0,0
cmp dword ,WM_NOTIFY
je near notify
cmp dword ,WM_INITDIALOG
je wminitdialog2
cmp dword ,WM_COMMAND
je near wmcommand2
;cmp dword ,WM_PAINT
;je near Paint2
;cmp dword ,WM_CLOSE
;je near wmclose
jmp near unhandled




;--------------
unhandled2:

mov eax,0 ;return false see win32api.hlp
leave
ret 16

;--------------
wminitdialog2:

;->set the menu

; call LoadMenuA,,ID_MENU ; ID_MENU equ Number in the resource file..

; call SetMenu,,eax ; eax ptIDMenu

;your code here... if needed... ;)

mov eax,1
leave
ret 16

;--------------
wmcommand2:
cmp dword , 101 ; IDC_BUTTON1
je near New1
cmp dword ,102 ; ID_.....
jmp near New2


;change the above to feet your code...


mov eax,1

ret 16









;--3Dialog-------------child one------------------------------------------


;*************************************************************
; 3DialogWndProc hwnd:DWORD, wmsg:DWORD, wparam:DWORD, lparam:DWORD
; ebp+8 ebp+12 ebp+16 ebp+20
; it?s allways like this !
;*************************************************************

@Dialog3Proc: ;change to your name to this Dialog... or keep if you like the name.. :)

%define hdlg3 ebp+8 ;hwnd ... like this name better :)
%define dlg3msg ebp+12 ;wmsg ... like this name better :)
%define wparam3 ebp+16
%define lparam3 ebp+20

enter 0,0
cmp dword ,WM_NOTIFY
je near notify
cmp dword ,WM_INITDIALOG
je wminitdialog3
cmp dword ,WM_COMMAND
je near wmcommand3
;cmp dword ,WM_PAINT
;je near Paint3
;cmp dword ,WM_CLOSE
;je near wmclose
jmp near unhandled
;--------------
wminitdialog3:

;->set the menu

; call LoadMenuA,,ID_MENU ; ID_MENU equ Number in the resource file..

; call SetMenu,,eax ; eax ptIDMenu

;your code here... if needed... ;)

mov eax,1
leave
ret 16

;--------------
wmcommand3:
cmp dword , 101 ; IDC_BUTTON2
je near New1
cmp dword , 102
jmp near New2


;change the above to feet your code...


mov eax,1
ret 16
;***************END**********************


and now the RC file





# define IDC_TAB1 1011
# define IDC_BUTTON1 101
# define IDC_BUTTON2 102

1000 DIALOG 40,70,204,79
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "TAB DIALOG NASM Thanks Latigo !"
FONT 8, "Helv"
BEGIN
CONTROL "Tab1",IDC_TAB1, "SysTabControl32", 0x0 ,0,0,203,78
END

1001 DIALOG 20,15,150,60
STYLE WS_CHILD
FONT 8, "Helv"
BEGIN
PUSHBUTTON "Dialog child 1", IDC_BUTTON1,23,19,102,22
END

1002 DIALOG 20,15,150,60
STYLE WS_CHILD
FONT 8, "Helv"
BEGIN
GROUPBOX "", 10, 20, 15, 130, 40
PUSHBUTTON "Dialog child 2", IDC_BUTTON2,23,19,102,22
END

Thanks for all that help me in this one!
Posted on 2001-08-19 19:50:02 by Nguga