#include "TabDlg.h"
#include <commctrl.h>
// DoLockDlgRes - loads and locks a dialog box template resource.
// Returns the address of the locked resource.
// lpszResName - name of the resource
DLGTEMPLATE* DoLockDlgRes(LPTSTR resName) {
HRSRC hrsrc = FindResource(NULL, resName, RT_DIALOG);
HGLOBAL hglb = LoadResource(0, hrsrc);
return (DLGTEMPLATE*) LockResource(hglb);
}
/*
WCHAR* GetResString(WCHAR*&p) {
if (*p==0xFFFF) { // numerische ID
++p;
return (WCHAR*)*p++;
}
WCHAR*r=p; // String
p+=wcslen(p)+1;
return r;
}
*/
// OnSelChanged - processes the TCN_SELCHANGE notification.
// hwndDlg - handle to the parent dialog box.
void DLGHDR::OnSelChange() {
int iSel = TabCtrl_GetCurSel(hwndTab);
DLGPAGE &pa=page[iSel];
if (hwndDisplay) ShowWindow(hwndDisplay,SW_HIDE);
// Create the new child dialog box.
if (!pa.hWnd) pa.hWnd=CreateDialogIndirect(0,
pa.pRes,hwndDlg,pa.dlgProc);
ShowWindow(hwndDisplay=pa.hWnd,SW_SHOW);
}
void DLGHDR::OnInit() {
TCITEM tie;
tie.mask = TCIF_TEXT/* | TCIF_IMAGE*/;
// tie.iImage = -1;
int i;
for (i=0; i<nPages; i++) {
DLGPAGE &pa=page[i];
pa.pRes = DoLockDlgRes(pa.szTemplate);
tie.pszText=PWSTR(pa.pRes)+sizeof(DLGTEMPLATE)/2+2; // Titel-Text
TabCtrl_InsertItem(hwndTab,i,&tie);
}
OnSelChange();
}
Detected encoding: UTF-8 | 0
|