How To Create Pocket PC-Style Property Sheets Using Win32 API (308593)



The information in this article applies to:

  • Microsoft Windows CE for the Pocket PC

This article was previously published under Q308593

SUMMARY

The Pocket PC Control Panel and MFC Pocket PC AppWizard applications have property sheets that are flat and have the tabs at the bottom. By default, the Win32 PropertySheet API creates property sheets that have a 3-D look and have the tabs on top. This article describes how to make property sheets that are created with the Win32 PropertySheet API look like those of the Pocket PC Control Panel and MFC Pocket PC AppWizard applications.

MORE INFORMATION

  1. Create the property sheet with the PSH_MAXIMIZE flag:
    void ShowPropSheet(HWND hWnd)
    {
      ...
      pshPropSheet.dwSize = sizeof(PROPSHEETHEADERW);
      pshPropSheet.dwFlags = PSH_USECALLBACK | PSH_MAXIMIZE;
      pshPropSheet.hwndParent = hWnd;
      pshPropSheet.hInstance = hInst;
      pshPropSheet.pszCaption = NULL;
      pshPropSheet.phpage = hphPage;
      pshPropSheet.nPages = 2;
      pshPropSheet.nStartPage = 1;
      pshPropSheet.pfnCallback = (PFNPROPSHEETCALLBACK) PropSheetProc;
    
      if (-1 == PropertySheet(&pshPropSheet))
      {
        ...
      }
    }
    					
  2. Handle the PSCB_GETVERSION message in the property sheet callback procedure to return COMCTL32_VERSION:
    int CALLBACK PropSheetProc(HWND hwndDlg,UINT uMsg,LPARAM lParam)
    {
      ...
      switch (uMsg)
      {
        ...
    
        case PSCB_GETVERSION:
          return COMCTL32_VERSION;
    
        default:
          break;
      }
      return 0;
    }
    
    						
    By returning this value, you are telling the system to use the visual style for the tab control that is associated with newer versions of the control.
NOTE: The Pocket PC documentation page for PropSheetProc incorrectly states a return type of void. However, the prsht.h header declares the function with a return type of int so the function definition for PropSheetProc shown in this section is correct.

Modification Type:MinorLast Reviewed:9/7/2004
Keywords:kbhowto KB308593