shcombox.h
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 7k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. // shcombox.h : Shared shell comboboxEx methods
  2. #ifndef __SHCOMBOX_H__
  3. #define __SHCOMBOX_H__
  4. //-------------------------------------------------------------------------//
  5. //  COMBOITEMEX wrap with string storage.
  6. typedef struct tagCBXITEMA
  7. {
  8.     UINT    mask;
  9.     INT_PTR iItem;
  10.     CHAR    szText[MAX_PATH] ;
  11.     int     cchTextMax;
  12.     int     iImage;
  13.     int     iSelectedImage;
  14.     int     iOverlay;
  15.     int     iIndent;
  16.     int     iID;  // application-specific item identifier.
  17.     ULONG   Reserved; 
  18.     LPARAM  lParam;
  19. } CBXITEMA, *PCBXITEMA ;
  20. typedef CBXITEMA CONST *PCCBXITEMA;
  21. typedef struct tagCBXITEMW
  22. {
  23.     UINT    mask;
  24.     INT_PTR iItem;
  25.     WCHAR   szText[MAX_PATH] ;
  26.     int     cchTextMax;
  27.     int     iImage;
  28.     int     iSelectedImage;
  29.     int     iOverlay;
  30.     int     iIndent;
  31.     int     iID;  // application-specific item identifier.
  32.     ULONG   Reserved; 
  33.     LPARAM  lParam;
  34. } CBXITEMW, *PCBXITEMW ;
  35. typedef CBXITEMW CONST *PCCBXITEMW;
  36. #ifdef UNICODE
  37. #define CBXITEM            CBXITEMW
  38. #define PCBXITEM           PCBXITEMW
  39. #define PCCBXITEM          PCCBXITEMW
  40. #else
  41. #define CBXITEM            CBXITEMA
  42. #define PCBXITEM           PCBXITEMA
  43. #define PCCBXITEM          PCCBXITEMA
  44. #endif
  45. //  ADDCBXITEMCALLBACK fAction flags
  46. #define CBXCB_ADDING       0x00000001     // if callback returns E_ABORT, combo population aborts
  47. #define CBXCB_ADDED        0x00000002     // callback's return value is ignored.
  48. //  SendMessageTimeout constants
  49. #define CBX_SNDMSG_TIMEOUT_FLAGS          SMTO_BLOCK
  50. #define CBX_SNDMSG_TIMEOUT                15000 // milliseconds
  51. #define CBX_SNDMSG_TIMEOUT_HRESULT        HRESULT_FROM_WIN32(ERROR_TIMEOUT)
  52. //  Misc constants
  53. #define NO_ITEM_NOICON_INDENT -2 // -1 to make up for the icon indent.
  54. #define NO_ITEM_INDENT       0
  55. #define ITEM_INDENT          1
  56. #define LISTINSERT_FIRST    0
  57. #define LISTINSERT_LAST     -1
  58. #ifdef __cplusplus
  59. extern "C"
  60. {
  61. #endif
  62. //-------------------------------------------------------------------------//
  63. //  General shell comboboxex methods
  64. typedef HRESULT (*LPFNPIDLENUM_CB)(LPITEMIDLIST, LPVOID);
  65. typedef HRESULT (WINAPI * ADDCBXITEMCALLBACK)( ULONG fAction, PCBXITEM pItem, LPARAM lParam ) ;
  66. HRESULT _AddCbxItemToComboBox( IN HWND hwndComboEx, IN PCCBXITEM pItem, IN INT_PTR *pnPosAdded ) ;
  67. HRESULT _AddCbxItemToComboBoxCallback( IN HWND hwndComboEx, IN OUT PCBXITEM pItem, IN ADDCBXITEMCALLBACK pfn, IN LPARAM lParam ) ;
  68. HRESULT _MakeCbxItem( OUT PCBXITEM pcbi, IN  LPCTSTR pszDisplayName, IN  LPVOID pvData, IN  LPCITEMIDLIST pidlIcon, IN  INT_PTR nPos, IN  int iIndent ) ;
  69. HRESULT _MakeCbxItemKnownImage( OUT PCBXITEM pcbi,IN  LPCTSTR pszDisplayName, IN  LPVOID pvData, IN  int iImage, IN  int iSelectedImage, IN  INT_PTR nPos, IN  int iIndent ) ;
  70. HRESULT _MakeCsidlIconCbxItem( OUT PCBXITEM pcbi,  LPCTSTR pszDisplayName,  LPVOID pvData, int nCsidlIcon, INT_PTR nPos, int iIndent ) ;
  71. HRESULT _MakeCsidlItemStrCbxItem( OUT PCBXITEM pcbi, IN  int nCsidlItem, IN  int nCsidlIcon, IN  INT_PTR nPos, IN  int iIndent ) ;
  72. HRESULT _MakeResourceAndCsidlStrCbxItem( OUT PCBXITEM pcbi,  IN  UINT idString, IN  int nCsidlItem, IN  int nCsidlIcon, IN  INT_PTR nPos, IN  int iIndent ) ;
  73. HRESULT _MakeResourceCbxItem( OUT PCBXITEM pcbi, IN  int idString, IN  DWORD dwData, IN  int nCsidlIcon, IN  INT_PTR nPos, IN  int iIndent ) ;
  74. HRESULT _MakeFileTypeCbxItem( OUT PCBXITEM pcbi, IN LPCTSTR pszDisplayName, IN  LPCTSTR pszExt, IN  LPCITEMIDLIST pidlIcon, IN  INT_PTR nPos, IN  int iIndent ) ;
  75. HRESULT _MakeCsidlCbxItem( OUT PCBXITEM pcbi, IN  int nCsidlItem, IN  int nCsidlIcon, IN  INT_PTR nPos, IN  int iIndent ) ;
  76. HRESULT _MakePidlCbxItem( OUT PCBXITEM pcbi, IN  LPITEMIDLIST pidl, IN  LPITEMIDLIST pidlIcon, IN  INT_PTR nPos, IN  int iIndent ) ;
  77. HRESULT _EnumSpecialItemIDs(int csidl, DWORD dwSHCONTF, LPFNPIDLENUM_CB pfn, LPVOID pvData);
  78. HRESULT _GetPidlIcon( IN LPCITEMIDLIST pidl, OUT int *piImage, OUT int *piSelectedImage ) ;
  79. HRESULT _EnumSpecialItemIDs( IN int csidl, IN DWORD dwSHCONTF, IN LPFNPIDLENUM_CB pfn, IN LPVOID pvData ) ;
  80. HIMAGELIST WINAPI _GetSystemImageListSmallIcons() ;
  81. //----------------------------------------
  82. //  Namespace picker combo methods.
  83. HRESULT WINAPI _PopulateNamespaceCombo( IN HWND hwndComboEx, IN ADDCBXITEMCALLBACK pfn, IN LPARAM lParam) ;
  84. LONG_PTR WINAPI _GetNamespaceComboItemText( IN HWND hwndComboEx, IN INT_PTR iItem, IN BOOL fPath, OUT LPTSTR pszText, IN int cchText) ;
  85. LONG_PTR WINAPI _GetNamespaceComboSelItemText( IN HWND hwndComboEx, IN BOOL fPath, OUT LPTSTR pszText, IN int cchText) ;
  86. LRESULT WINAPI _DeleteNamespaceComboItem( IN LPNMHDR pnmh ) ;
  87. //  helpers (note: once all dependents are brought into line using the above methods, we can eliminate
  88. //  decl of the following:
  89. HRESULT        _BuildDrivesList( IN UINT uiFilter, IN LPCTSTR pszSeparator, IN LPCTSTR pszEnd, OUT LPTSTR pszString, IN DWORD cchSize ) ;
  90. HRESULT        _MakeMyComputerCbxItem( OUT PCBXITEM pItem ) ;
  91. HRESULT        _MakeLocalHardDrivesCbxItem( OUT PCBXITEM pItem ) ;
  92. HRESULT        _MakeMappedDrivesCbxItem( OUT PCBXITEM pItem, IN LPITEMIDLIST pidl) ;
  93. HRESULT        _MakeNethoodDirsCbxItem( OUT PCBXITEM pItem, IN LPITEMIDLIST pidl ) ;
  94. HRESULT        _MakeBrowseForCbxItem( OUT PCBXITEM pItem ) ;
  95. HRESULT        _MakeNetworkPlacesCbxItem( OUT PCBXITEM pItem, IN LPVOID lParam ) ;
  96. HRESULT        _MakeRecentFolderCbxItem( OUT PCBXITEM pItem ) ;
  97. typedef HRESULT (*LPFNRECENTENUM_CB)(IN LPCTSTR pszPath, IN BOOL fAddEntries, IN LPVOID pvParam);
  98. HRESULT        _EnumRecentAndGeneratePath( IN BOOL fAddEntries, IN LPFNRECENTENUM_CB pfn, IN LPVOID pvParam ) ;
  99. #define NAMESPACECOMBO_RECENT_PARAM    TEXT("$RECENT$")
  100. #define CBX_CSIDL_LOCALDRIVES          0x04FF   // arbitrarily out of range of other CSIDL_xxx values.
  101. //----------------------------------------
  102. //  File Associations picker combo methods.
  103. HRESULT WINAPI    _PopulateFileAssocCombo( IN HWND, IN ADDCBXITEMCALLBACK, IN LPARAM) ;
  104. LONG WINAPI       _GetFileAssocComboSelItemText( IN HWND, OUT LPTSTR *ppszText) ;
  105. LRESULT WINAPI    _DeleteFileAssocComboItem( IN LPNMHDR pnmh ) ;
  106. //  helpers (note: once all dependents are brought into line using the above methods, we can eliminate
  107. //  decl of the following:
  108. HRESULT _AddFileType( IN HWND hwndComboBox, IN LPCTSTR pszDisplayName, IN LPCTSTR pszExt, IN LPCITEMIDLIST pidlIcon, IN int iIndent,
  109.                       IN OPTIONAL ADDCBXITEMCALLBACK pfn, IN OPTIONAL LPARAM lParam ) ;
  110. HRESULT _AddFileTypes( IN HWND hwndComboBox, IN OPTIONAL ADDCBXITEMCALLBACK pfn, IN OPTIONAL LPARAM lParam ) ;
  111. // Hack Alert: impl in filetype.cpp
  112. STDAPI_(DWORD) GetFileTypeAttributes( HKEY hkeyFT );
  113. #define FILEASSOCIATIONSID_ALLFILETYPES          20
  114. #define FILEASSOCIATIONSID_FILE_PATH             1   // Go parse it.
  115. #define FILEASSOCIATIONSID_MAX                   FILEASSOCIATIONSID_ALLFILETYPES
  116. //-------------------------------------------------------------------------//
  117. #ifdef __cplusplus
  118. }
  119. #endif
  120. #endif __SHCOMBOX_H__