May 13th, 2010, 09:38 PM
#1
How to set font to sheet's Caption when use PropertySheet
Now I have a project was developed by C++ and Windows API.
This project is run at Wince.
It use PropertySheet to create and display the dialog.
I can set the controls font in resource file。
But I don't know how to set the font to tab sheet's caption .
Attached Files
May 13th, 2010, 09:40 PM
#2
Re: How to set font to sheet's Caption when use PropertySheet
The source code
BOOL CALLBACK DlgBuzzer(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
NMHDR *nmhdr;
int i;
BOOL bRadio;
HWND hTemp;
#ifdef WIN32_PLATFORM_PSPC
SHINITDLGINFO shidi;
#endif
switch(message){
// Initialize BuzzerSetting
case WM_INITDIALOG:
#ifdef WIN32_PLATFORM_PSPC
shidi.hDlg = hDlg;
shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_EMPTYMENU;
SHInitDialog(&shidi);
#endif
InitDlgBuzzer(hDlg);
return TRUE;
// Save or Not Save BuzzerSetting
case WM_NOTIFY:
nmhdr = (NMHDR*)lParam;
switch(nmhdr->code){
case PSN_APPLY:
TerminateDlgBuzzer(hDlg, TRUE);
break;
case PSN_QUERYCANCEL:
TerminateDlgBuzzer(hDlg, FALSE);
break;
/*case PSN_KILLACTIVE:
break;*/
}
break;
// Enable / Disable Radio Button
case WM_COMMAND:
switch(LOWORD(wParam)){
case IDC_CHECK1:
case IDC_CHECK2:
case IDC_CHECK3:
case IDC_CHECK4:
bRadio = (BOOL)SendDlgItemMessage(hDlg, LOWORD(wParam), BM_GETCHECK, 0, 0);
for(i=1; i<4; i++){
hTemp = GetDlgItem(hDlg, LOWORD(wParam)+i);
EnableWindow(hTemp, bRadio);
}
break;
// Play Buzzer
case IDC_BUTTON1: TestBuzzer(hDlg, B_ALARM); break;
case IDC_BUTTON2: TestBuzzer(hDlg, B_WARNING); break;
case IDC_BUTTON3: TestBuzzer(hDlg, B_SCANEND); break;
case IDC_BUTTON4: TestBuzzer(hDlg, B_USERDEF); break;
}
break;
// OwnerDraw Button
case WM_DRAWITEM:
DrawButton(hDlg, g_hIcon, (LPDRAWITEMSTRUCT)lParam);
return TRUE;
}
return FALSE;
}
int CALLBACK PropSheetCallback(HWND hDlg, UINT uMsg, LPARAM lParam)
{
#ifdef WIN32_PLATFORM_PSPC //BUILD_POCKETPC
TCHAR tcsTitle[256];
#endif
switch(uMsg)
{
#ifdef WIN32_PLATFORM_PSPC //BUILD_POCKETPC
case PSCB_GETTITLE:
LoadString(g_hInst, ID_CPLCAPTION, tcsTitle, sizeof(tcsTitle));
wcscpy((TCHAR*)lParam, tcsTitle);
break;
case PSCB_GETVERSION:
return COMCTL32_VERSION;
#endif
}
return 0;
}
// Show Property Sheet
int MyProperty(HWND hWnd, HINSTANCE hInst)
{
PROPSHEETPAGE psp[2];
PROPSHEETHEADER psh;
TCHAR szName[32];
ZeroMemory(szName, sizeof szName);
LoadString( hInst, IDS_SETTINGS, szName, sizeof szName );
psp[0].dwSize = sizeof(PROPSHEETPAGE);
psp[0].dwFlags = PSP_DEFAULT;
psp[0].hInstance= hInst;
psp[0].lParam = (LPARAM)hWnd;
psp[0].pszTemplate = MAKEINTRESOURCE(IDD_DIALOG1);
psp[0].pfnDlgProc = DlgBuzzer;
psh.dwSize = sizeof(PROPSHEETHEADER);
#ifdef WIN32_PLATFORM_PSPC //BUILD_POCKETPC
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK | PSH_MAXIMIZE;
#else
psh.dwFlags = PSH_PROPSHEETPAGE;
#endif
psh.hwndParent = hWnd;
psh.hInstance = hInst;
psh.pszCaption = szName;
psh.nPages = 1;
psh.nStartPage = 0;
psh.ppsp = psp;
psh.pfnCallback = PropSheetCallback;
PropertySheet(&psh);
return 0;
}
May 25th, 2010, 09:02 PM
#3
Re: How to set font to sheet's Caption when use PropertySheet
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width