Below is the code i tried to use in a tab control for "changing page". It wont work because the TCM_GETCURSEL always returns
0, no matter which tab is clicked. What's wrong here?



.elseif iMsg==WM_NOTIFY
MOV EAX,lParam
.if [eax].NMHDR.code==TCN_SELCHANGING
invoke SendMessage,hOptionsTab,TCM_GETCURSEL,0,0
PrintDec eax,"changing from"
mov ecx,sizeof OptPage
mul ecx
add eax,offset OptPages
invoke ShowWindow,[eax].OptPage.hwnddlg,SW_HIDE


.elseif [eax].NMHDR.code==TCN_SELCHANGE
invoke SendMessage,hOptionsTab,TCM_GETCURSEL,0,0
PrintDec eax,"changing to"
mov ecx,sizeof OptPage
mul ecx
add eax,offset OptPages
invoke ShowWindow,[eax].OptPage.hwnddlg,SW_SHOWDEFAULT
.endif
Posted on 2004-02-23 09:57:22 by Janne
You may check out KetilO's web page, in projects, there is such an example. Work on it or modify to your own suits. I dont know what is

.OptPage.hwnddlg

OptPages
..

But superficially, you need,

SelectedTab dd ?
hTabDlg dd 3 dup(?)

.elseif eax==WM_INITDIALOG
[...]
invoke CreateDialogParam,hInstance,IDD_TAB1,hTab,addr Tab1Proc,0
mov hTabDlg,eax
invoke CreateDialogParam,hInstance,IDD_TAB2,hTab,addr Tab2Proc,0
mov hTabDlg[4],eax
invoke CreateDialogParam,hInstance,IDD_TAB3,hTab,addr Tab3Proc,0
mov hTabDlg[8],eax
[...]
.if eax==TCN_SELCHANGE
invoke SendMessage,hTab,TCM_GETCURSEL,0,0
.if eax!=SelectedTab
push eax
mov eax,SelectedTab
invoke ShowWindow,,SW_HIDE
pop eax
mov SelectedTab,eax
invoke ShowWindow,,SW_SHOWDEFAULT
.endif

You must to show-hide in cases together. In TCN_SELCHANGE your code part is not complate.

Good Luck
Posted on 2004-02-23 20:23:27 by cakmak
It works now, my error turned out to be really simple & stupid:
I had the variable for the tab handle (hOptionsTab) defined as LOCAL. So i put instead in .data
hOptionsTab dd 0
, then it works.
Posted on 2004-02-24 11:18:46 by Janne