Hello all I hope someone can help me I am working on a simple application which uses tab controls I have set this up and working fine. My handlers for the second dialog tab is below and contains a pop up to confirm the button was clicked which works ok.
INT_PTR CALLBACK TabDialogTwo(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
break;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDC_CHECK_ACCOUNT:
// This doesnt work
HWND hwndStatic = GetDlgItem(hwndDlg, IDC_STATIC1);
Static_SetText(hwndStatic, "Button Works");
// This does as expected
MessageBox(hwndDlg,TEXT("User Account Selected"),TEXT("Button"),0);
break;
}
break;
}
}
return FALSE ;
}
My problem is the buttons which are on my tab controls wont update my static bar using this code
// This doesnt work from inside the tab window but does work in my intial dialog function
HWND hwndStatic = GetDlgItem(hwndDlg, IDC_STATIC1);
Static_SetText(hwndStatic, "Button Works???");
Do I need to change the handle to hwnd->hwndDlg ? this comes up undefined as its not.
All I want to do is be able to change my status bar from within the tab controls is this possible? I have searched for 8 days now non stop so thought I would ask the experts.
Many thanks
UPDATE FIXED : See Pezcode Example below. thanks to all helpers.
Replace
with
GetDlgItemonly gets controls inside the window you give to it.hwndDlgin that context is the dialog inside the tab. But to get thehwndStatichandle to the static bar of the main dialog, you have to get up two levels (via theGetParentAPI).Once up is the tab control, another one up is your main dialog.