Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

269 lines
10 KiB

  1. #ifndef __cmnquryp_h
  2. #define __cmnquryp_h
  3. DEFINE_GUID(IID_IQueryFrame, 0x7e8c7c20, 0x7c9d, 0x11d0, 0x91, 0x3f, 0x0, 0xaa, 0x00, 0xc1, 0x6e, 0x65);
  4. DEFINE_GUID(IID_IQueryHandler, 0xa60cc73f, 0xe0fc, 0x11d0, 0x97, 0x50, 0x0, 0xa0, 0xc9, 0x06, 0xaf, 0x45);
  5. #ifndef GUID_DEFS_ONLY
  6. #define CQFF_ISNEVERLISTED 0x0000004 // = 1 => form not listed in the form selector
  7. #define CQPF_ISGLOBAL 0x00000001 // = 1 => this page is global, and added to all forms
  8. #define OQWF_HIDESEARCHPANE 0x00000100 // = 1 => hide the search pane by on opening
  9. //-----------------------------------------------------------------------------
  10. // Query handler interfaces structures etc
  11. //-----------------------------------------------------------------------------
  12. //
  13. // Query Scopes
  14. // ============
  15. // A query scope is an opaque structure passed between the query handler
  16. // and the query frame. When the handler is first invoked it is asked
  17. // to declare its scope objects, which inturn the frame holds. When the
  18. // query is issued the scope is passed back to the handler.
  19. //
  20. // When a scope is registered the cbSize field of the structure passed
  21. // is used to define how large the scope is, that entire blob is then
  22. // copied into a heap allocation. Therefore allowing the handler
  23. // to create scope blocks on the stack, knowing that the frame will
  24. // take a copy when it calls the AddProc.
  25. //
  26. struct _cqscope;
  27. typedef struct _cqscope CQSCOPE;
  28. typedef CQSCOPE* LPCQSCOPE;
  29. typedef HRESULT (CALLBACK *LPCQSCOPEPROC)(LPCQSCOPE pScope, UINT uMsg, LPVOID pVoid);
  30. struct _cqscope
  31. {
  32. DWORD cbStruct;
  33. DWORD dwFlags;
  34. LPCQSCOPEPROC pScopeProc;
  35. LPARAM lParam;
  36. };
  37. #define CQSM_INITIALIZE 0x0000000
  38. #define CQSM_RELEASE 0x0000001
  39. #define CQSM_GETDISPLAYINFO 0x0000003 // pVoid -> CQSCOPEDISPLAYINFO
  40. #define CQSM_SCOPEEQUAL 0x0000004 // pVoid -> CQSCOPE
  41. typedef struct
  42. {
  43. DWORD cbStruct;
  44. DWORD dwFlags;
  45. LPWSTR pDisplayName;
  46. INT cchDisplayName;
  47. LPWSTR pIconLocation;
  48. INT cchIconLocation;
  49. INT iIconResID;
  50. INT iIndent;
  51. } CQSCOPEDISPLAYINFO, * LPCQSCOPEDISPLAYINFO;
  52. //
  53. // Command ID's reserved for the frame to use when talking to
  54. // the handler. The handler must use only the IDs in the
  55. // range defined by CQID_MINHANDLERMENUID and CQID_MAXHANDLERMENUID
  56. //
  57. #define CQID_MINHANDLERMENUID 0x0100
  58. #define CQID_MAXHANDLERMENUID 0x4000 // all handler IDs must be below this threshold
  59. #define CQID_FILE_CLOSE (CQID_MAXHANDLERMENUID + 0x0100)
  60. #define CQID_VIEW_SEARCHPANE (CQID_MAXHANDLERMENUID + 0x0101)
  61. #define CQID_LOOKFORLABEL (CQID_MAXHANDLERMENUID + 0x0200)
  62. #define CQID_LOOKFOR (CQID_MAXHANDLERMENUID + 0x0201)
  63. #define CQID_LOOKINLABEL (CQID_MAXHANDLERMENUID + 0x0202)
  64. #define CQID_LOOKIN (CQID_MAXHANDLERMENUID + 0x0203)
  65. #define CQID_BROWSE (CQID_MAXHANDLERMENUID + 0x0204)
  66. #define CQID_FINDNOW (CQID_MAXHANDLERMENUID + 0x0205)
  67. #define CQID_STOP (CQID_MAXHANDLERMENUID + 0x0206)
  68. #define CQID_CLEARALL (CQID_MAXHANDLERMENUID + 0x0207)
  69. #define CQID_RESULTSLABEL (CQID_MAXHANDLERMENUID + 0x0208)
  70. //
  71. // When calling IQueryHandler::ActivateView the following reason codes
  72. // are passed to indicate the type of activation being performed
  73. //
  74. #define CQRVA_ACTIVATE 0x00 // wParam = 0, lParam = 0
  75. #define CQRVA_DEACTIVATE 0x01 // wParam = 0, lParam = 0
  76. #define CQRVA_INITMENUBAR 0x02 // wParam/lParam => WM_INITMENU
  77. #define CQRVA_INITMENUBARPOPUP 0x03 // wParam/lParam => WM_INITMENUPOPUP
  78. #define CQRVA_FORMCHANGED 0x04 // wParam = title length, lParam -> title string
  79. #define CQRVA_STARTQUERY 0x05 // wParam = fStarted, lParam = 0
  80. #define CQRVA_HELP 0x06 // wParma = 0, lParam = LPHELPINFO
  81. #define CQRVA_CONTEXTMENU 0x07 // wParam/lParam from the WM_CONTEXTMENU call on the frame
  82. //
  83. // The frame creates the view and then queries the handler for display
  84. // information (title, icon, animation etc). These are all loaded as
  85. // resources from the hInstance specified, if 0 is specified for any
  86. // of the resource ID's then defaults are used.
  87. //
  88. typedef struct
  89. {
  90. DWORD dwFlags; // display attributes
  91. HINSTANCE hInstance; // resource hInstance
  92. INT idLargeIcon; // resource ID's for icons
  93. INT idSmallIcon;
  94. INT idTitle; // resource ID for title string
  95. INT idAnimation; // resource ID for animation
  96. } CQVIEWINFO, * LPCQVIEWINFO;
  97. //
  98. // IQueryHandler::GetViewObject is passed a scope indiciator to allow it
  99. // to trim the result set. All handlers must support CQRVS_SELECTION. Also,
  100. // CQRVS_HANDLERMASK defines the flags available for the handler to
  101. // use internally.
  102. //
  103. #define CQRVS_ALL 0x00000001
  104. #define CQRVS_SELECTION 0x00000002
  105. #define CQRVS_MASK 0x00ffffff
  106. #define CQRVS_HANDLERMASK 0xff000000
  107. //
  108. // When invoking the query all the parameters, the scope, the form
  109. // etc are bundled into this structure and then passed to the
  110. // IQueryHandler::IssueQuery method, it inturn populates the view
  111. // previously created with IQueryHandler::CreateResultView.
  112. //
  113. typedef struct
  114. {
  115. DWORD cbStruct;
  116. DWORD dwFlags;
  117. LPCQSCOPE pQueryScope; // handler specific scope
  118. LPVOID pQueryParameters; // handle specific argument block
  119. CLSID clsidForm; // form ID
  120. } CQPARAMS, * LPCQPARAMS;
  121. //
  122. // Query Frame Window Messages
  123. // ===========================
  124. //
  125. // CQFWM_ADDSCOPE
  126. // --------------
  127. // wParam = LPCQSCOPE, lParam = HIWORD(index), LOWORD(fSelect)
  128. //
  129. // Add a scope to the scope list of the dialog, allows async scope collection
  130. // to be performed. When the handlers AddScopes method is called then
  131. // handler can return S_OK, spin off a thread and post CQFWM_ADDSCOPE
  132. // messages to the frame, which will inturn allow the scopes to be
  133. // added to the control. When the frame receives this message it copies
  134. // the scope as it does on IQueryFrame::AddScope, if the call fails it
  135. // returns FALSE.
  136. //
  137. #define CQFWM_ADDSCOPE (WM_USER+256)
  138. //
  139. // CQFWM_GETFRAME
  140. // --------------
  141. // wParam = 0, lParam = (IQueryFrame**)
  142. //
  143. // Allows an object to query for the frame window's IQueryFrame
  144. // interface, this is used by the property well to talk to the
  145. // other forms within the system.
  146. //
  147. #define CQFWM_GETFRAME (WM_USER+257)
  148. //
  149. // CQFWM_ALLSCOPESADDED
  150. // --------------------
  151. // wParam = 0, lParam = 0
  152. //
  153. // If a handler is adding scopes async, then it should issue this message
  154. // when all the scopes have been added. That way if the caller specifies
  155. // OQWF_ISSUEONOPEN we can start the query once all the scopes have been
  156. // added.
  157. //
  158. #define CQFWM_ALLSCOPESADDED (WM_USER+258)
  159. //
  160. // CQFWM_STARTQUERY
  161. // ----------------
  162. // wParam = 0, lParam = 0
  163. //
  164. // This call can be made by the frame or the form, it allows it to
  165. // start the query running in those cases where a form really needs
  166. // this functionality.
  167. //
  168. // NB: this should be kept private!
  169. //
  170. #define CQFWM_STARTQUERY (WM_USER+259)
  171. //
  172. // CQFWM_SETDEFAULTFOCUS
  173. // ---------------------
  174. // Posted to ourselves to ensure focus is on the right control.
  175. //
  176. #define CQFWM_SETDEFAULTFOCUS (WM_USER+260)
  177. //
  178. // IQueryFrame
  179. //
  180. #undef INTERFACE
  181. #define INTERFACE IQueryFrame
  182. DECLARE_INTERFACE_(IQueryFrame, IUnknown)
  183. {
  184. // *** IUnknown methods ***
  185. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  186. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  187. STDMETHOD_(ULONG,Release)(THIS) PURE;
  188. // *** IQueryFrame methods ***
  189. STDMETHOD(AddScope)(THIS_ LPCQSCOPE pScope, INT i, BOOL fSelect) PURE;
  190. STDMETHOD(GetWindow)(THIS_ HWND* phWnd) PURE;
  191. STDMETHOD(InsertMenus)(THIS_ HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidth) PURE;
  192. STDMETHOD(RemoveMenus)(THIS_ HMENU hmenuShared) PURE;
  193. STDMETHOD(SetMenu)(THIS_ HMENU hmenuShared, HOLEMENU holereservedMenu) PURE;
  194. STDMETHOD(SetStatusText)(THIS_ LPCTSTR pszStatusText) PURE;
  195. STDMETHOD(StartQuery)(THIS_ BOOL fStarting) PURE;
  196. STDMETHOD(LoadQuery)(THIS_ IPersistQuery* pPersistQuery) PURE;
  197. STDMETHOD(SaveQuery)(THIS_ IPersistQuery* pPersistQuery) PURE;
  198. STDMETHOD(CallForm)(THIS_ LPCLSID pForm, UINT uMsg, WPARAM wParam, LPARAM lParam) PURE;
  199. STDMETHOD(GetScope)(THIS_ LPCQSCOPE* ppScope) PURE;
  200. STDMETHOD(GetHandler)(THIS_ REFIID riid, void **ppv) PURE;
  201. };
  202. //
  203. // IQueryHandler interface
  204. //
  205. #undef INTERFACE
  206. #define INTERFACE IQueryHandler
  207. DECLARE_INTERFACE_(IQueryHandler, IUnknown)
  208. {
  209. // *** IUnknown methods ***
  210. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  211. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  212. STDMETHOD_(ULONG,Release)(THIS) PURE;
  213. // *** IQueryHandler methods ***
  214. STDMETHOD(Initialize)(THIS_ IQueryFrame* pQueryFrame, DWORD dwOQWFlags, LPVOID pParameters) PURE;
  215. STDMETHOD(GetViewInfo)(THIS_ LPCQVIEWINFO pViewInfo) PURE;
  216. STDMETHOD(AddScopes)(THIS) PURE;
  217. STDMETHOD(BrowseForScope)(THIS_ HWND hwndParent, LPCQSCOPE pCurrentScope, LPCQSCOPE* ppScope) PURE;
  218. STDMETHOD(CreateResultView)(THIS_ HWND hwndParent, HWND* phWndView) PURE;
  219. STDMETHOD(ActivateView)(THIS_ UINT uState, WPARAM wParam, LPARAM lParam) PURE;
  220. STDMETHOD(InvokeCommand)(THIS_ HWND hwndParent, UINT idCmd) PURE;
  221. STDMETHOD(GetCommandString)(THIS_ UINT idCmd, DWORD dwFlags, LPTSTR pBuffer, INT cchBuffer) PURE;
  222. STDMETHOD(IssueQuery)(THIS_ LPCQPARAMS pQueryParams) PURE;
  223. STDMETHOD(StopQuery)(THIS) PURE;
  224. STDMETHOD(GetViewObject)(THIS_ UINT uScope, REFIID riid, LPVOID* ppvOut) PURE;
  225. STDMETHOD(LoadQuery)(THIS_ IPersistQuery* pPersistQuery) PURE;
  226. STDMETHOD(SaveQuery)(THIS_ IPersistQuery* pPersistQuery, LPCQSCOPE pScope) PURE;
  227. };
  228. #endif // GUID_DEFS_ONLY
  229. #endif