CmnQuery.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:8k
源码类别:

模拟服务器

开发平台:

C/C++

  1. #ifndef __cmnquery_h
  2. #define __cmnquery_h
  3. DEFINE_GUID(IID_IQueryForm, 0x8cfcee30, 0x39bd, 0x11d0, 0xb8, 0xd1, 0x0, 0xa0, 0x24, 0xab, 0x2d, 0xbb);
  4. DEFINE_GUID(IID_IPersistQuery, 0x1a3114b8, 0xa62e, 0x11d0, 0xa6, 0xc5, 0x0, 0xa0, 0xc9, 0x06, 0xaf, 0x45);
  5. DEFINE_GUID(CLSID_CommonQuery,  0x83bc5ec0, 0x6f2a, 0x11d0, 0xa1, 0xc4, 0x0, 0xaa, 0x00, 0xc1, 0x6e, 0x65);
  6. DEFINE_GUID(IID_ICommonQuery, 0xab50dec0, 0x6f1d, 0x11d0, 0xa1, 0xc4, 0x0, 0xaa, 0x00, 0xc1, 0x6e, 0x65);
  7. #ifndef GUID_DEFS_ONLY
  8. //-----------------------------------------------------------------------------
  9. // IQueryForm
  10. //-----------------------------------------------------------------------------
  11. //
  12. // A query form object is registered under the query handlers CLSID,
  13. // a list is stored in the registry:
  14. //
  15. //  HKCRCLSID{CLSID query handler}Forms
  16. //
  17. // For each form object there are server values which can be defined:
  18. //
  19. //  Flags           = flags for the form object:
  20. //                      QUERYFORM_CHANGESFORMLIST
  21. //                      QUERYFORM_CHANGESOPTFORMLIST
  22. //
  23. //  CLSID           = string containing the CLSID of the InProc server to invoke
  24. //                    to get the IQueryFormObject.
  25. //
  26. //  Forms           = a sub key containing the CLSIDs for the forms registered
  27. //                    by IQueryForm::AddForms (or modified by ::AddPages), if
  28. //                    the flags are 0, then we scan this list looking for a match
  29. //                    for the default form specified.
  30. //
  31. #define QUERYFORM_CHANGESFORMLIST       0x000000001
  32. #define QUERYFORM_CHANGESOPTFORMLIST    0x000000002
  33. //
  34. // Query Forms
  35. // ===========
  36. //  Query forms are registered and have query pages added to them, a form without
  37. //  pages is not displayed.  Each form has a unique CLSID to allow it to be
  38. //  selected by invoking the query dialog.
  39. //
  40. #define CQFF_NOGLOBALPAGES  0x0000001       // = 1 => doesn't have global pages added
  41. #define CQFF_ISOPTIONAL     0x0000002       // = 1 => form is hidden, unless optional forms requested
  42. typedef struct
  43. {
  44.     DWORD   cbStruct;
  45.     DWORD   dwFlags;
  46.     CLSID   clsid;
  47.     HICON   hIcon;
  48.     LPCWSTR pszTitle;
  49. } CQFORM, * LPCQFORM;
  50. typedef HRESULT (CALLBACK *LPCQADDFORMSPROC)(LPARAM lParam, LPCQFORM pForm);
  51. //
  52. // Query Form Pages
  53. // ================
  54. //  When a query form has been registered the caller can then add pages to it,
  55. //  any form can have pages appended.
  56. //
  57. struct _cqpage;
  58. typedef struct _cqpage CQPAGE, * LPCQPAGE;
  59. typedef HRESULT (CALLBACK *LPCQADDPAGESPROC)(LPARAM lParam, REFCLSID clsidForm, LPCQPAGE pPage);
  60. typedef HRESULT (CALLBACK *LPCQPAGEPROC)(LPCQPAGE pPage, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  61. struct _cqpage
  62. {
  63.     DWORD        cbStruct;
  64.     DWORD        dwFlags;
  65.     LPCQPAGEPROC pPageProc;
  66.     HINSTANCE    hInstance;
  67.     INT          idPageName;
  68.     INT          idPageTemplate;
  69.     DLGPROC      pDlgProc;
  70.     LPARAM       lParam;
  71. };
  72. //
  73. // IQueryForm interfaces
  74. //
  75. #undef  INTERFACE
  76. #define INTERFACE IQueryForm
  77. DECLARE_INTERFACE_(IQueryForm, IUnknown)
  78. {
  79.     // *** IUnknown methods ***
  80.     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  81.     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  82.     STDMETHOD_(ULONG,Release)(THIS) PURE;
  83.     // IQueryForm methods
  84.     STDMETHOD(Initialize)(THIS_ HKEY hkForm) PURE;
  85.     STDMETHOD(AddForms)(THIS_ LPCQADDFORMSPROC pAddFormsProc, LPARAM lParam) PURE;
  86.     STDMETHOD(AddPages)(THIS_ LPCQADDPAGESPROC pAddPagesProc, LPARAM lParam) PURE;
  87. };
  88. //
  89. // Messages for pages
  90. //
  91. #define CQPM_INITIALIZE             0x00000001
  92. #define CQPM_RELEASE                0x00000002
  93. #define CQPM_ENABLE                 0x00000003 // wParam = TRUE/FALSE (enable, disable), lParam = 0
  94. #define CQPM_GETPARAMETERS          0x00000005 // wParam = 0, lParam = -> receives the LocalAlloc
  95. #define CQPM_CLEARFORM              0x00000006 // wParam, lParam = 0
  96. #define CQPM_PERSIST                0x00000007 // wParam = fRead, lParam -> IPersistQuery
  97. #define CQPM_HELP                   0x00000008 // wParam = 0, lParam -> LPHELPINFO
  98. #define CQPM_SETDEFAULTPARAMETERS   0x00000009 // wParam = 0, lParam -> OPENQUERYWINDOW
  99. #define CQPM_HANDLERSPECIFIC        0x10000000
  100. //-----------------------------------------------------------------------------
  101. // IPersistQuery
  102. //-----------------------------------------------------------------------------
  103. // IPersistQuery interface
  104. #undef  INTERFACE
  105. #define INTERFACE IPersistQuery
  106. DECLARE_INTERFACE_(IPersistQuery, IPersist)
  107. {
  108.     // *** IUnknown methods ***
  109.     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  110.     STDMETHOD_(ULONG,AddRef)(THIS)  PURE;
  111.     STDMETHOD_(ULONG,Release)(THIS) PURE;
  112.     // IPersist
  113.     STDMETHOD(GetClassID)(THIS_ CLSID* pClassID) PURE;
  114.     // IPersistQuery
  115.     STDMETHOD(WriteString)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPCWSTR pValue) PURE;
  116.     STDMETHOD(ReadString)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPWSTR pBuffer, INT cchBuffer) PURE;
  117.     STDMETHOD(WriteInt)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, INT value) PURE;
  118.     STDMETHOD(ReadInt)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPINT pValue) PURE;
  119.     STDMETHOD(WriteStruct)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPVOID pStruct, DWORD cbStruct) PURE;
  120.     STDMETHOD(ReadStruct)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPVOID pStruct, DWORD cbStruct) PURE;
  121.     STDMETHOD(Clear)(THIS) PURE;
  122. };
  123. //-----------------------------------------------------------------------------
  124. // ICommonQuery
  125. //-----------------------------------------------------------------------------
  126. #define OQWF_OKCANCEL               0x00000001 // = 1 => Provide OK/Cancel buttons
  127. #define OQWF_DEFAULTFORM            0x00000002 // = 1 => clsidDefaultQueryForm is valid
  128. #define OQWF_SINGLESELECT           0x00000004 // = 1 => view to have single selection (depends on viewer)
  129. #define OQWF_LOADQUERY              0x00000008 // = 1 => use the IPersistQuery to load the given query
  130. #define OQWF_REMOVESCOPES           0x00000010 // = 1 => remove scope picker from dialog
  131. #define OQWF_REMOVEFORMS            0x00000020 // = 1 => remove form picker from dialog
  132. #define OQWF_ISSUEONOPEN            0x00000040 // = 1 => issue query on opening the dialog
  133. #define OQWF_SHOWOPTIONAL           0x00000080 // = 1 => list optional forms by default
  134. #define OQWF_SAVEQUERYONOK          0x00000200 // = 1 => use the IPersistQuery to write the query on close
  135. #define OQWF_HIDEMENUS              0x00000400 // = 1 => no menu bar displayed
  136. #define OQWF_HIDESEARCHUI           0x00000800 // = 1 => dialog is filter, therefore start, stop, new search etc
  137. #define OQWF_PARAMISPROPERTYBAG     0x80000000 // = 1 => the form parameters ptr is an IPropertyBag (ppbFormParameters)
  138. typedef struct
  139. {
  140.     DWORD           cbStruct;                   // structure size
  141.     DWORD           dwFlags;                    // flags (OQFW_*)
  142.     CLSID           clsidHandler;               // clsid of handler we are using
  143.     LPVOID          pHandlerParameters;         // handler specific structure for initialization
  144.     CLSID           clsidDefaultForm;           // default form to be selected (if OQF_DEFAULTFORM == 1 )
  145.     IPersistQuery*  pPersistQuery;              // IPersistQuery used for loading queries
  146.     union
  147.     {
  148.         void*         pFormParameters;
  149.         IPropertyBag* ppbFormParameters;
  150.     };
  151. } OPENQUERYWINDOW, * LPOPENQUERYWINDOW;
  152. // ICommonQuery
  153. #undef  INTERFACE
  154. #define INTERFACE ICommonQuery
  155. DECLARE_INTERFACE_(ICommonQuery, IUnknown)
  156. {
  157.     // *** IUnknown methods ***
  158.     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  159.     STDMETHOD_(ULONG,AddRef)(THIS)  PURE;
  160.     STDMETHOD_(ULONG,Release)(THIS) PURE;
  161.     // ICommonQuery methods
  162.     STDMETHOD(OpenQueryWindow)(THIS_ HWND hwndParent, LPOPENQUERYWINDOW pQueryWnd, IDataObject** ppDataObject) PURE;
  163. };
  164. #endif  // GUID_DEFS_ONLY
  165. #endif