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.

487 lines
18 KiB

  1. #ifndef __cmnquery_h
  2. #define __cmnquery_h
  3. #ifndef __cmnquryp_h ;internal
  4. #define __cmnquryp_h ;internal
  5. DEFINE_GUID(IID_IQueryForm, 0x8cfcee30, 0x39bd, 0x11d0, 0xb8, 0xd1, 0x0, 0xa0, 0x24, 0xab, 0x2d, 0xbb);
  6. DEFINE_GUID(IID_IPersistQuery, 0x1a3114b8, 0xa62e, 0x11d0, 0xa6, 0xc5, 0x0, 0xa0, 0xc9, 0x06, 0xaf, 0x45);
  7. DEFINE_GUID(CLSID_CommonQuery, 0x83bc5ec0, 0x6f2a, 0x11d0, 0xa1, 0xc4, 0x0, 0xaa, 0x00, 0xc1, 0x6e, 0x65);
  8. DEFINE_GUID(IID_ICommonQuery, 0xab50dec0, 0x6f1d, 0x11d0, 0xa1, 0xc4, 0x0, 0xaa, 0x00, 0xc1, 0x6e, 0x65);
  9. ;begin_internal
  10. DEFINE_GUID(IID_IQueryFrame, 0x7e8c7c20, 0x7c9d, 0x11d0, 0x91, 0x3f, 0x0, 0xaa, 0x00, 0xc1, 0x6e, 0x65);
  11. DEFINE_GUID(IID_IQueryHandler, 0xa60cc73f, 0xe0fc, 0x11d0, 0x97, 0x50, 0x0, 0xa0, 0xc9, 0x06, 0xaf, 0x45);
  12. ;end_internal
  13. #ifndef GUID_DEFS_ONLY ;both
  14. //-----------------------------------------------------------------------------
  15. // IQueryForm
  16. //-----------------------------------------------------------------------------
  17. //
  18. // A query form object is registered under the query handlers CLSID,
  19. // a list is stored in the registry:
  20. //
  21. // HKCR\CLSID\{CLSID query handler}\Forms
  22. //
  23. // For each form object there are server values which can be defined:
  24. //
  25. // Flags = flags for the form object:
  26. // QUERYFORM_CHANGESFORMLIST
  27. // QUERYFORM_CHANGESOPTFORMLIST
  28. //
  29. // CLSID = string containing the CLSID of the InProc server to invoke
  30. // to get the IQueryFormObject.
  31. //
  32. // Forms = a sub key containing the CLSIDs for the forms registered
  33. // by IQueryForm::AddForms (or modified by ::AddPages), if
  34. // the flags are 0, then we scan this list looking for a match
  35. // for the default form specified.
  36. //
  37. #define QUERYFORM_CHANGESFORMLIST 0x000000001
  38. #define QUERYFORM_CHANGESOPTFORMLIST 0x000000002
  39. //
  40. // Query Forms
  41. // ===========
  42. // Query forms are registered and have query pages added to them, a form without
  43. // pages is not displayed. Each form has a unique CLSID to allow it to be
  44. // selected by invoking the query dialog.
  45. //
  46. #define CQFF_NOGLOBALPAGES 0x0000001 // = 1 => doesn't have global pages added
  47. #define CQFF_ISOPTIONAL 0x0000002 // = 1 => form is hidden, unless optional forms requested
  48. ;begin_internal
  49. #define CQFF_ISNEVERLISTED 0x0000004 // = 1 => form not listed in the form selector
  50. ;end_internal
  51. typedef struct
  52. {
  53. DWORD cbStruct;
  54. DWORD dwFlags;
  55. CLSID clsid;
  56. HICON hIcon;
  57. LPCWSTR pszTitle;
  58. } CQFORM, * LPCQFORM;
  59. typedef HRESULT (CALLBACK *LPCQADDFORMSPROC)(LPARAM lParam, LPCQFORM pForm);
  60. //
  61. // Query Form Pages
  62. // ================
  63. // When a query form has been registered the caller can then add pages to it,
  64. // any form can have pages appended.
  65. //
  66. ;begin_internal
  67. #define CQPF_ISGLOBAL 0x00000001 // = 1 => this page is global, and added to all forms
  68. ;end_internal
  69. struct _cqpage;
  70. typedef struct _cqpage CQPAGE, * LPCQPAGE;
  71. typedef HRESULT (CALLBACK *LPCQADDPAGESPROC)(LPARAM lParam, REFCLSID clsidForm, LPCQPAGE pPage);
  72. typedef HRESULT (CALLBACK *LPCQPAGEPROC)(LPCQPAGE pPage, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  73. struct _cqpage
  74. {
  75. DWORD cbStruct;
  76. DWORD dwFlags;
  77. LPCQPAGEPROC pPageProc;
  78. HINSTANCE hInstance;
  79. INT idPageName;
  80. INT idPageTemplate;
  81. DLGPROC pDlgProc;
  82. LPARAM lParam;
  83. };
  84. //
  85. // IQueryForm interfaces
  86. //
  87. #undef INTERFACE
  88. #define INTERFACE IQueryForm
  89. DECLARE_INTERFACE_(IQueryForm, IUnknown)
  90. {
  91. // *** IUnknown methods ***
  92. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  93. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  94. STDMETHOD_(ULONG,Release)(THIS) PURE;
  95. // IQueryForm methods
  96. STDMETHOD(Initialize)(THIS_ HKEY hkForm) PURE;
  97. STDMETHOD(AddForms)(THIS_ LPCQADDFORMSPROC pAddFormsProc, LPARAM lParam) PURE;
  98. STDMETHOD(AddPages)(THIS_ LPCQADDPAGESPROC pAddPagesProc, LPARAM lParam) PURE;
  99. };
  100. //
  101. // Messages for pages
  102. //
  103. #define CQPM_INITIALIZE 0x00000001
  104. #define CQPM_RELEASE 0x00000002
  105. #define CQPM_ENABLE 0x00000003 // wParam = TRUE/FALSE (enable, disable), lParam = 0
  106. #define CQPM_GETPARAMETERS 0x00000005 // wParam = 0, lParam = -> receives the LocalAlloc
  107. #define CQPM_CLEARFORM 0x00000006 // wParam, lParam = 0
  108. #define CQPM_PERSIST 0x00000007 // wParam = fRead, lParam -> IPersistQuery
  109. #define CQPM_HELP 0x00000008 // wParam = 0, lParam -> LPHELPINFO
  110. #define CQPM_SETDEFAULTPARAMETERS 0x00000009 // wParam = 0, lParam -> OPENQUERYWINDOW
  111. #define CQPM_HANDLERSPECIFIC 0x10000000
  112. //-----------------------------------------------------------------------------
  113. // IPersistQuery
  114. //-----------------------------------------------------------------------------
  115. // IPersistQuery interface
  116. #undef INTERFACE
  117. #define INTERFACE IPersistQuery
  118. DECLARE_INTERFACE_(IPersistQuery, IPersist)
  119. {
  120. // *** IUnknown methods ***
  121. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  122. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  123. STDMETHOD_(ULONG,Release)(THIS) PURE;
  124. // IPersist
  125. STDMETHOD(GetClassID)(THIS_ CLSID* pClassID) PURE;
  126. // IPersistQuery
  127. STDMETHOD(WriteString)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPCWSTR pValue) PURE;
  128. STDMETHOD(ReadString)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPWSTR pBuffer, INT cchBuffer) PURE;
  129. STDMETHOD(WriteInt)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, INT value) PURE;
  130. STDMETHOD(ReadInt)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPINT pValue) PURE;
  131. STDMETHOD(WriteStruct)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPVOID pStruct, DWORD cbStruct) PURE;
  132. STDMETHOD(ReadStruct)(THIS_ LPCWSTR pSection, LPCWSTR pValueName, LPVOID pStruct, DWORD cbStruct) PURE;
  133. STDMETHOD(Clear)(THIS) PURE;
  134. };
  135. //-----------------------------------------------------------------------------
  136. // ICommonQuery
  137. //-----------------------------------------------------------------------------
  138. #define OQWF_OKCANCEL 0x00000001 // = 1 => Provide OK/Cancel buttons
  139. #define OQWF_DEFAULTFORM 0x00000002 // = 1 => clsidDefaultQueryForm is valid
  140. #define OQWF_SINGLESELECT 0x00000004 // = 1 => view to have single selection (depends on viewer)
  141. #define OQWF_LOADQUERY 0x00000008 // = 1 => use the IPersistQuery to load the given query
  142. #define OQWF_REMOVESCOPES 0x00000010 // = 1 => remove scope picker from dialog
  143. #define OQWF_REMOVEFORMS 0x00000020 // = 1 => remove form picker from dialog
  144. #define OQWF_ISSUEONOPEN 0x00000040 // = 1 => issue query on opening the dialog
  145. #define OQWF_SHOWOPTIONAL 0x00000080 // = 1 => list optional forms by default
  146. ;begin_internal
  147. #define OQWF_HIDESEARCHPANE 0x00000100 // = 1 => hide the search pane by on opening
  148. ;end_internal
  149. #define OQWF_SAVEQUERYONOK 0x00000200 // = 1 => use the IPersistQuery to write the query on close
  150. #define OQWF_HIDEMENUS 0x00000400 // = 1 => no menu bar displayed
  151. #define OQWF_HIDESEARCHUI 0x00000800 // = 1 => dialog is filter, therefore start, stop, new search etc
  152. #define OQWF_PARAMISPROPERTYBAG 0x80000000 // = 1 => the form parameters ptr is an IPropertyBag (ppbFormParameters)
  153. typedef struct
  154. {
  155. DWORD cbStruct; // structure size
  156. DWORD dwFlags; // flags (OQFW_*)
  157. CLSID clsidHandler; // clsid of handler we are using
  158. LPVOID pHandlerParameters; // handler specific structure for initialization
  159. CLSID clsidDefaultForm; // default form to be selected (if OQF_DEFAULTFORM == 1 )
  160. IPersistQuery* pPersistQuery; // IPersistQuery used for loading queries
  161. union
  162. {
  163. void* pFormParameters;
  164. IPropertyBag* ppbFormParameters;
  165. };
  166. } OPENQUERYWINDOW, * LPOPENQUERYWINDOW;
  167. // ICommonQuery
  168. #undef INTERFACE
  169. #define INTERFACE ICommonQuery
  170. DECLARE_INTERFACE_(ICommonQuery, IUnknown)
  171. {
  172. // *** IUnknown methods ***
  173. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  174. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  175. STDMETHOD_(ULONG,Release)(THIS) PURE;
  176. // ICommonQuery methods
  177. STDMETHOD(OpenQueryWindow)(THIS_ HWND hwndParent, LPOPENQUERYWINDOW pQueryWnd, IDataObject** ppDataObject) PURE;
  178. };
  179. ;begin_internal
  180. //-----------------------------------------------------------------------------
  181. // Query handler interfaces structures etc
  182. //-----------------------------------------------------------------------------
  183. //
  184. // Query Scopes
  185. // ============
  186. // A query scope is an opaque structure passed between the query handler
  187. // and the query frame. When the handler is first invoked it is asked
  188. // to declare its scope objects, which inturn the frame holds. When the
  189. // query is issued the scope is passed back to the handler.
  190. //
  191. // When a scope is registered the cbSize field of the structure passed
  192. // is used to define how large the scope is, that entire blob is then
  193. // copied into a heap allocation. Therefore allowing the handler
  194. // to create scope blocks on the stack, knowing that the frame will
  195. // take a copy when it calls the AddProc.
  196. //
  197. struct _cqscope;
  198. typedef struct _cqscope CQSCOPE;
  199. typedef CQSCOPE* LPCQSCOPE;
  200. typedef HRESULT (CALLBACK *LPCQSCOPEPROC)(LPCQSCOPE pScope, UINT uMsg, LPVOID pVoid);
  201. struct _cqscope
  202. {
  203. DWORD cbStruct;
  204. DWORD dwFlags;
  205. LPCQSCOPEPROC pScopeProc;
  206. LPARAM lParam;
  207. };
  208. #define CQSM_INITIALIZE 0x0000000
  209. #define CQSM_RELEASE 0x0000001
  210. #define CQSM_GETDISPLAYINFO 0x0000003 // pVoid -> CQSCOPEDISPLAYINFO
  211. #define CQSM_SCOPEEQUAL 0x0000004 // pVoid -> CQSCOPE
  212. typedef struct
  213. {
  214. DWORD cbStruct;
  215. DWORD dwFlags;
  216. LPWSTR pDisplayName;
  217. INT cchDisplayName;
  218. LPWSTR pIconLocation;
  219. INT cchIconLocation;
  220. INT iIconResID;
  221. INT iIndent;
  222. } CQSCOPEDISPLAYINFO, * LPCQSCOPEDISPLAYINFO;
  223. //
  224. // Command ID's reserved for the frame to use when talking to
  225. // the handler. The handler must use only the IDs in the
  226. // range defined by CQID_MINHANDLERMENUID and CQID_MAXHANDLERMENUID
  227. //
  228. #define CQID_MINHANDLERMENUID 0x0100
  229. #define CQID_MAXHANDLERMENUID 0x4000 // all handler IDs must be below this threshold
  230. #define CQID_FILE_CLOSE (CQID_MAXHANDLERMENUID + 0x0100)
  231. #define CQID_VIEW_SEARCHPANE (CQID_MAXHANDLERMENUID + 0x0101)
  232. #define CQID_LOOKFORLABEL (CQID_MAXHANDLERMENUID + 0x0200)
  233. #define CQID_LOOKFOR (CQID_MAXHANDLERMENUID + 0x0201)
  234. #define CQID_LOOKINLABEL (CQID_MAXHANDLERMENUID + 0x0202)
  235. #define CQID_LOOKIN (CQID_MAXHANDLERMENUID + 0x0203)
  236. #define CQID_BROWSE (CQID_MAXHANDLERMENUID + 0x0204)
  237. #define CQID_FINDNOW (CQID_MAXHANDLERMENUID + 0x0205)
  238. #define CQID_STOP (CQID_MAXHANDLERMENUID + 0x0206)
  239. #define CQID_CLEARALL (CQID_MAXHANDLERMENUID + 0x0207)
  240. #define CQID_RESULTSLABEL (CQID_MAXHANDLERMENUID + 0x0208)
  241. //
  242. // When calling IQueryHandler::ActivateView the following reason codes
  243. // are passed to indicate the type of activation being performed
  244. //
  245. #define CQRVA_ACTIVATE 0x00 // wParam = 0, lParam = 0
  246. #define CQRVA_DEACTIVATE 0x01 // wParam = 0, lParam = 0
  247. #define CQRVA_INITMENUBAR 0x02 // wParam/lParam => WM_INITMENU
  248. #define CQRVA_INITMENUBARPOPUP 0x03 // wParam/lParam => WM_INITMENUPOPUP
  249. #define CQRVA_FORMCHANGED 0x04 // wParam = title length, lParam -> title string
  250. #define CQRVA_STARTQUERY 0x05 // wParam = fStarted, lParam = 0
  251. #define CQRVA_HELP 0x06 // wParma = 0, lParam = LPHELPINFO
  252. #define CQRVA_CONTEXTMENU 0x07 // wParam/lParam from the WM_CONTEXTMENU call on the frame
  253. //
  254. // The frame creates the view and then queries the handler for display
  255. // information (title, icon, animation etc). These are all loaded as
  256. // resources from the hInstance specified, if 0 is specified for any
  257. // of the resource ID's then defaults are used.
  258. //
  259. typedef struct
  260. {
  261. DWORD dwFlags; // display attributes
  262. HINSTANCE hInstance; // resource hInstance
  263. INT idLargeIcon; // resource ID's for icons
  264. INT idSmallIcon;
  265. INT idTitle; // resource ID for title string
  266. INT idAnimation; // resource ID for animation
  267. } CQVIEWINFO, * LPCQVIEWINFO;
  268. //
  269. // IQueryHandler::GetViewObject is passed a scope indiciator to allow it
  270. // to trim the result set. All handlers must support CQRVS_SELECTION. Also,
  271. // CQRVS_HANDLERMASK defines the flags available for the handler to
  272. // use internally.
  273. //
  274. #define CQRVS_ALL 0x00000001
  275. #define CQRVS_SELECTION 0x00000002
  276. #define CQRVS_MASK 0x00ffffff
  277. #define CQRVS_HANDLERMASK 0xff000000
  278. //
  279. // When invoking the query all the parameters, the scope, the form
  280. // etc are bundled into this structure and then passed to the
  281. // IQueryHandler::IssueQuery method, it inturn populates the view
  282. // previously created with IQueryHandler::CreateResultView.
  283. //
  284. typedef struct
  285. {
  286. DWORD cbStruct;
  287. DWORD dwFlags;
  288. LPCQSCOPE pQueryScope; // handler specific scope
  289. LPVOID pQueryParameters; // handle specific argument block
  290. CLSID clsidForm; // form ID
  291. } CQPARAMS, * LPCQPARAMS;
  292. //
  293. // Query Frame Window Messages
  294. // ===========================
  295. //
  296. // CQFWM_ADDSCOPE
  297. // --------------
  298. // wParam = LPCQSCOPE, lParam = HIWORD(index), LOWORD(fSelect)
  299. //
  300. // Add a scope to the scope list of the dialog, allows async scope collection
  301. // to be performed. When the handlers AddScopes method is called then
  302. // handler can return S_OK, spin off a thread and post CQFWM_ADDSCOPE
  303. // messages to the frame, which will inturn allow the scopes to be
  304. // added to the control. When the frame receives this message it copies
  305. // the scope as it does on IQueryFrame::AddScope, if the call fails it
  306. // returns FALSE.
  307. //
  308. #define CQFWM_ADDSCOPE (WM_USER+256)
  309. //
  310. // CQFWM_GETFRAME
  311. // --------------
  312. // wParam = 0, lParam = (IQueryFrame**)
  313. //
  314. // Allows an object to query for the frame window's IQueryFrame
  315. // interface, this is used by the property well to talk to the
  316. // other forms within the system.
  317. //
  318. #define CQFWM_GETFRAME (WM_USER+257)
  319. //
  320. // CQFWM_ALLSCOPESADDED
  321. // --------------------
  322. // wParam = 0, lParam = 0
  323. //
  324. // If a handler is adding scopes async, then it should issue this message
  325. // when all the scopes have been added. That way if the caller specifies
  326. // OQWF_ISSUEONOPEN we can start the query once all the scopes have been
  327. // added.
  328. //
  329. #define CQFWM_ALLSCOPESADDED (WM_USER+258)
  330. //
  331. // CQFWM_STARTQUERY
  332. // ----------------
  333. // wParam = 0, lParam = 0
  334. //
  335. // This call can be made by the frame or the form, it allows it to
  336. // start the query running in those cases where a form really needs
  337. // this functionality.
  338. //
  339. // NB: this should be kept private!
  340. //
  341. #define CQFWM_STARTQUERY (WM_USER+259)
  342. //
  343. // CQFWM_SETDEFAULTFOCUS
  344. // ---------------------
  345. // Posted to ourselves to ensure focus is on the right control.
  346. //
  347. #define CQFWM_SETDEFAULTFOCUS (WM_USER+260)
  348. //
  349. // IQueryFrame
  350. //
  351. #undef INTERFACE
  352. #define INTERFACE IQueryFrame
  353. DECLARE_INTERFACE_(IQueryFrame, IUnknown)
  354. {
  355. // *** IUnknown methods ***
  356. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  357. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  358. STDMETHOD_(ULONG,Release)(THIS) PURE;
  359. // *** IQueryFrame methods ***
  360. STDMETHOD(AddScope)(THIS_ LPCQSCOPE pScope, INT i, BOOL fSelect) PURE;
  361. STDMETHOD(GetWindow)(THIS_ HWND* phWnd) PURE;
  362. STDMETHOD(InsertMenus)(THIS_ HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidth) PURE;
  363. STDMETHOD(RemoveMenus)(THIS_ HMENU hmenuShared) PURE;
  364. STDMETHOD(SetMenu)(THIS_ HMENU hmenuShared, HOLEMENU holereservedMenu) PURE;
  365. STDMETHOD(SetStatusText)(THIS_ LPCTSTR pszStatusText) PURE;
  366. STDMETHOD(StartQuery)(THIS_ BOOL fStarting) PURE;
  367. STDMETHOD(LoadQuery)(THIS_ IPersistQuery* pPersistQuery) PURE;
  368. STDMETHOD(SaveQuery)(THIS_ IPersistQuery* pPersistQuery) PURE;
  369. STDMETHOD(CallForm)(THIS_ LPCLSID pForm, UINT uMsg, WPARAM wParam, LPARAM lParam) PURE;
  370. STDMETHOD(GetScope)(THIS_ LPCQSCOPE* ppScope) PURE;
  371. STDMETHOD(GetHandler)(THIS_ REFIID riid, void **ppv) PURE;
  372. };
  373. //
  374. // IQueryHandler interface
  375. //
  376. #undef INTERFACE
  377. #define INTERFACE IQueryHandler
  378. DECLARE_INTERFACE_(IQueryHandler, IUnknown)
  379. {
  380. // *** IUnknown methods ***
  381. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  382. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  383. STDMETHOD_(ULONG,Release)(THIS) PURE;
  384. // *** IQueryHandler methods ***
  385. STDMETHOD(Initialize)(THIS_ IQueryFrame* pQueryFrame, DWORD dwOQWFlags, LPVOID pParameters) PURE;
  386. STDMETHOD(GetViewInfo)(THIS_ LPCQVIEWINFO pViewInfo) PURE;
  387. STDMETHOD(AddScopes)(THIS) PURE;
  388. STDMETHOD(BrowseForScope)(THIS_ HWND hwndParent, LPCQSCOPE pCurrentScope, LPCQSCOPE* ppScope) PURE;
  389. STDMETHOD(CreateResultView)(THIS_ HWND hwndParent, HWND* phWndView) PURE;
  390. STDMETHOD(ActivateView)(THIS_ UINT uState, WPARAM wParam, LPARAM lParam) PURE;
  391. STDMETHOD(InvokeCommand)(THIS_ HWND hwndParent, UINT idCmd) PURE;
  392. STDMETHOD(GetCommandString)(THIS_ UINT idCmd, DWORD dwFlags, LPTSTR pBuffer, INT cchBuffer) PURE;
  393. STDMETHOD(IssueQuery)(THIS_ LPCQPARAMS pQueryParams) PURE;
  394. STDMETHOD(StopQuery)(THIS) PURE;
  395. STDMETHOD(GetViewObject)(THIS_ UINT uScope, REFIID riid, LPVOID* ppvOut) PURE;
  396. STDMETHOD(LoadQuery)(THIS_ IPersistQuery* pPersistQuery) PURE;
  397. STDMETHOD(SaveQuery)(THIS_ IPersistQuery* pPersistQuery, LPCQSCOPE pScope) PURE;
  398. };
  399. ;end_internal
  400. ;begin_both
  401. #endif // GUID_DEFS_ONLY
  402. #endif
  403. ;end_both