home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c495 / 8.ddi / WATCM958.ARJ / NT_H.WPK / DDEML.H next >
Encoding:
C/C++ Source or Header  |  1993-02-16  |  16.0 KB  |  448 lines

  1. /*++ BUILD Version: 0001    // Increment this if a change has global effects */
  2.  
  3. /*****************************************************************************\
  4. *                                                                             *
  5. *  ddeml.h -    DDEML API header file
  6. *                                                                             *
  7. *               Version 3.10                                                  *                   *
  8. *                                                                             *
  9. *               Copyright (c) 1992, Microsoft Corp.  All rights reserved.     *
  10. *                                                                             *
  11. \*****************************************************************************/
  12. #ifndef _INC_DDEMLH
  13. #define _INC_DDEMLH
  14.  
  15. /******** public types ********/
  16.  
  17. typedef DWORD         HCONVLIST;
  18. typedef DWORD        HCONV;
  19. typedef DWORD         HSZ;
  20. typedef DWORD        HDDEDATA;
  21. #define EXPENTRY
  22.  
  23. /* the following structure is for use with XTYP_WILDCONNECT processing. */
  24.  
  25. typedef struct tagHSZPAIR {
  26.     HSZ hszSvc;
  27.     HSZ hszTopic;
  28. } HSZPAIR;
  29. typedef HSZPAIR FAR *PHSZPAIR;
  30.  
  31. /* The following structure is used by DdeConnect() and DdeConnectList() and
  32.    by XTYP_CONNECT and XTYP_WILDCONNECT callbacks. */
  33.  
  34. typedef struct tagCONVCONTEXT {
  35.     UINT        cb;             /* set to sizeof(CONVCONTEXT) */
  36.     UINT        wFlags;         /* none currently defined. */
  37.     UINT        wCountryID;     /* country code for topic/item strings used. */
  38.     int         iCodePage;      /* codepage used for topic/item strings. */
  39.     DWORD       dwLangID;       /* language ID for topic/item strings. */
  40.     DWORD       dwSecurity;     /* Private security code. */
  41. } CONVCONTEXT;
  42. typedef CONVCONTEXT FAR *PCONVCONTEXT;
  43.  
  44.  
  45. /* The following structure is used by DdeQueryConvInfo(): */
  46.  
  47. typedef struct tagCONVINFO {
  48.     DWORD   cb;            /* sizeof(CONVINFO)  */
  49.     DWORD   hUser;         /* user specified field  */
  50.     HCONV   hConvPartner;  /* hConv on other end or 0 if non-ddemgr partner  */
  51.     HSZ     hszSvcPartner; /* app name of partner if obtainable  */
  52.     HSZ     hszServiceReq; /* AppName requested for connection  */
  53.     HSZ     hszTopic;      /* Topic name for conversation  */
  54.     HSZ     hszItem;       /* transaction item name or NULL if quiescent  */
  55.     UINT    wFmt;          /* transaction format or NULL if quiescent  */
  56.     UINT    wType;         /* XTYP_ for current transaction  */
  57.     UINT    wStatus;       /* ST_ constant for current conversation  */
  58.     UINT    wConvst;       /* XST_ constant for current transaction  */
  59.     UINT    wLastError;    /* last transaction error.  */
  60.     HCONVLIST hConvList;   /* parent hConvList if this conversation is in a list */
  61.     CONVCONTEXT ConvCtxt;  /* conversation context */
  62.     HWND    hwnd;          /* window handle for this conversation */
  63.     HWND    hwndPartner;   /* partner window handle for this conversation */
  64. } CONVINFO;
  65. typedef CONVINFO FAR *PCONVINFO;
  66.  
  67. /***** conversation states (usState) *****/
  68.  
  69. #define     XST_NULL              0  /* quiescent states */
  70. #define     XST_INCOMPLETE        1
  71. #define     XST_CONNECTED         2
  72. #define     XST_INIT1             3  /* mid-initiation states */
  73. #define     XST_INIT2             4
  74. #define     XST_REQSENT           5  /* active conversation states */
  75. #define     XST_DATARCVD          6
  76. #define     XST_POKESENT          7
  77. #define     XST_POKEACKRCVD       8
  78. #define     XST_EXECSENT          9
  79. #define     XST_EXECACKRCVD      10
  80. #define     XST_ADVSENT          11
  81. #define     XST_UNADVSENT        12
  82. #define     XST_ADVACKRCVD       13
  83. #define     XST_UNADVACKRCVD     14
  84. #define     XST_ADVDATASENT      15
  85. #define     XST_ADVDATAACKRCVD   16
  86.  
  87. /* used in LOWORD(dwData1) of XTYP_ADVREQ callbacks... */
  88. #define     CADV_LATEACK         0xFFFF
  89.  
  90. /***** conversation status bits (fsStatus) *****/
  91.  
  92. #define     ST_CONNECTED        0x0001
  93. #define     ST_ADVISE           0x0002
  94. #define     ST_ISLOCAL          0x0004
  95. #define     ST_BLOCKED          0x0008
  96. #define     ST_CLIENT           0x0010
  97. #define     ST_TERMINATED       0x0020
  98. #define     ST_INLIST           0x0040
  99. #define     ST_BLOCKNEXT        0x0080
  100. #define     ST_ISSELF           0x0100
  101.  
  102.  
  103. /* DDE constants for wStatus field */
  104.  
  105. #define DDE_FACK          0x8000
  106. #define DDE_FBUSY          0x4000
  107. #define DDE_FDEFERUPD        0x4000
  108. #define DDE_FACKREQ            0x8000
  109. #define DDE_FRELEASE          0x2000
  110. #define DDE_FREQUESTED        0x1000
  111. #define DDE_FAPPSTATUS        0x00ff
  112. #define DDE_FNOTPROCESSED       0x0000
  113.  
  114. #define DDE_FACKRESERVED    (~(DDE_FACK | DDE_FBUSY | DDE_FAPPSTATUS))
  115. #define DDE_FADVRESERVED    (~(DDE_FACKREQ | DDE_FDEFERUPD))
  116. #define DDE_FDATRESERVED    (~(DDE_FACKREQ | DDE_FRELEASE | DDE_FREQUESTED))
  117. #define DDE_FPOKRESERVED    (~(DDE_FRELEASE))
  118.  
  119. /***** message filter hook types *****/
  120.  
  121. #define     MSGF_DDEMGR             0x8001
  122.  
  123. /***** codepage constants ****/
  124.  
  125. #define CP_WINANSI      1004    /* default codepage for windows & old DDE convs. */
  126. #define CP_WINUNICODE   1200
  127.  
  128. /***** transaction types *****/
  129.  
  130. #define     XTYPF_NOBLOCK            0x0002  /* CBR_BLOCK will not work */
  131. #define     XTYPF_NODATA             0x0004  /* DDE_FDEFERUPD */
  132. #define     XTYPF_ACKREQ             0x0008  /* DDE_FACKREQ */
  133.  
  134. #define     XCLASS_MASK              0xFC00
  135. #define     XCLASS_BOOL              0x1000
  136. #define     XCLASS_DATA              0x2000
  137. #define     XCLASS_FLAGS             0x4000
  138. #define     XCLASS_NOTIFICATION      0x8000
  139.  
  140. #define     XTYP_ERROR              (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
  141. #define     XTYP_ADVDATA            (0x0010 | XCLASS_FLAGS         )
  142. #define     XTYP_ADVREQ             (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK )
  143. #define     XTYP_ADVSTART           (0x0030 | XCLASS_BOOL          )
  144. #define     XTYP_ADVSTOP            (0x0040 | XCLASS_NOTIFICATION)
  145. #define     XTYP_EXECUTE            (0x0050 | XCLASS_FLAGS         )
  146. #define     XTYP_CONNECT            (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
  147. #define     XTYP_CONNECT_CONFIRM    (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  148. #define     XTYP_XACT_COMPLETE      (0x0080 | XCLASS_NOTIFICATION  )
  149. #define     XTYP_POKE               (0x0090 | XCLASS_FLAGS         )
  150. #define     XTYP_REGISTER           (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  151. #define     XTYP_REQUEST            (0x00B0 | XCLASS_DATA          )
  152. #define     XTYP_DISCONNECT         (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  153. #define     XTYP_UNREGISTER         (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  154. #define     XTYP_WILDCONNECT        (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
  155.  
  156. #define     XTYP_MASK                0x00F0
  157. #define     XTYP_SHIFT               4  /* shift to turn XTYP_ into an index */
  158.  
  159. /***** Timeout constants *****/
  160.  
  161. #define     TIMEOUT_ASYNC           0xFFFFFFFF
  162.  
  163. /***** Transaction ID constants *****/
  164.  
  165. #define     QID_SYNC                0xFFFFFFFF
  166.  
  167. /****** public strings used in DDE ******/
  168.  
  169. #define SZDDESYS_TOPIC          "System"
  170. #define SZDDESYS_ITEM_TOPICS    "Topics"
  171. #define SZDDESYS_ITEM_SYSITEMS  "SysItems"
  172. #define SZDDESYS_ITEM_RTNMSG    "ReturnMessage"
  173. #define SZDDESYS_ITEM_STATUS    "Status"
  174. #define SZDDESYS_ITEM_FORMATS   "Formats"
  175. #define SZDDESYS_ITEM_HELP      "Help"
  176. #define SZDDE_ITEM_ITEMLIST     "TopicItemList"
  177.  
  178.  
  179. /****** API entry points ******/
  180.  
  181. typedef HDDEDATA CALLBACK FNCALLBACK(UINT wType, UINT wFmt, HCONV hConv,
  182.         HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1, DWORD dwData2);
  183. typedef FNCALLBACK *PFNCALLBACK;
  184.  
  185. #define     CBR_BLOCK                0xffffffffL
  186.  
  187. /* DLL registration functions */
  188.  
  189. UINT WINAPI DdeInitializeA(LPDWORD pidInst, PFNCALLBACK pfnCallback,
  190.         DWORD afCmd, DWORD ulRes);
  191. UINT WINAPI DdeInitializeW(LPDWORD pidInst, PFNCALLBACK pfnCallback,
  192.         DWORD afCmd, DWORD ulRes);
  193. #ifdef UNICODE
  194. #define DdeInitialize DdeInitializeW
  195. #else
  196. #define DdeInitialize DdeInitializeA
  197. #endif // !UNICODE
  198.  
  199. /*
  200.  * Callback filter flags for use with standard apps.
  201.  */
  202.  
  203. #define     CBF_FAIL_SELFCONNECTIONS     0x00001000
  204. #define     CBF_FAIL_CONNECTIONS         0x00002000
  205. #define     CBF_FAIL_ADVISES             0x00004000
  206. #define     CBF_FAIL_EXECUTES            0x00008000
  207. #define     CBF_FAIL_POKES               0x00010000
  208. #define     CBF_FAIL_REQUESTS            0x00020000
  209. #define     CBF_FAIL_ALLSVRXACTIONS      0x0003f000
  210.  
  211. #define     CBF_SKIP_CONNECT_CONFIRMS    0x00040000
  212. #define     CBF_SKIP_REGISTRATIONS       0x00080000
  213. #define     CBF_SKIP_UNREGISTRATIONS     0x00100000
  214. #define     CBF_SKIP_DISCONNECTS         0x00200000
  215. #define     CBF_SKIP_ALLNOTIFICATIONS    0x003c0000
  216.  
  217. /*
  218.  * Application command flags
  219.  */
  220. #define     APPCMD_CLIENTONLY            0x00000010L
  221. #define     APPCMD_FILTERINITS           0x00000020L
  222. #define     APPCMD_MASK                  0x00000FF0L
  223.  
  224. /*
  225.  * Application classification flags
  226.  */
  227. #define     APPCLASS_STANDARD            0x00000000L
  228. #define     APPCLASS_MASK                0x0000000FL
  229.  
  230.  
  231.  
  232. BOOL WINAPI DdeUninitialize(DWORD idInst);
  233.  
  234. /* conversation enumeration functions */
  235.  
  236. HCONVLIST WINAPI DdeConnectList(DWORD idInst, HSZ hszService, HSZ hszTopic,
  237.         HCONVLIST hConvList, PCONVCONTEXT pCC);
  238. HCONV WINAPI DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev);
  239. BOOL WINAPI DdeDisconnectList(HCONVLIST hConvList);
  240.  
  241. /* conversation control functions */
  242.  
  243. HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic,
  244.         PCONVCONTEXT pCC);
  245. BOOL WINAPI DdeDisconnect(HCONV hConv);
  246. HCONV WINAPI DdeReconnect(HCONV hConv);
  247. UINT WINAPI DdeQueryConvInfo(HCONV hConv, DWORD idTransaction, PCONVINFO pConvInfo);
  248. BOOL WINAPI DdeSetUserHandle(HCONV hConv, DWORD id, DWORD hUser);
  249. BOOL WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction);
  250.  
  251.  
  252. /* app server interface functions */
  253.  
  254. BOOL WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem);
  255. BOOL WINAPI DdeEnableCallback(DWORD idInst, HCONV hConv, UINT wCmd);
  256. BOOL WINAPI DdeImpersonateClient(HCONV hCOnv);
  257.  
  258. #define EC_ENABLEALL            0
  259. #define EC_ENABLEONE            ST_BLOCKNEXT
  260. #define EC_DISABLE              ST_BLOCKED
  261. #define EC_QUERYWAITING         2
  262.  
  263.  
  264. HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd);
  265.  
  266. #define DNS_REGISTER        0x0001
  267. #define DNS_UNREGISTER      0x0002
  268. #define DNS_FILTERON        0x0004
  269. #define DNS_FILTEROFF       0x0008
  270.  
  271. /* app client interface functions */
  272.  
  273. HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData,
  274.         HCONV hConv, HSZ hszItem, UINT wFmt, UINT wType,
  275.         DWORD dwTimeout, LPDWORD pdwResult);
  276.  
  277. /* data transfer functions */
  278.  
  279. HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb,
  280.         DWORD cbOff, HSZ hszItem, UINT wFmt, UINT afCmd);
  281. HDDEDATA WINAPI DdeAddData(HDDEDATA hData, LPBYTE pSrc, DWORD cb, DWORD cbOff);
  282. DWORD WINAPI DdeGetData(HDDEDATA hData, LPBYTE pDst, DWORD cbMax, DWORD cbOff);
  283. LPBYTE WINAPI DdeAccessData(HDDEDATA hData, LPDWORD pcbDataSize);
  284. BOOL WINAPI DdeUnaccessData(HDDEDATA hData);
  285. BOOL WINAPI DdeFreeDataHandle(HDDEDATA hData);
  286.  
  287. #define     HDATA_APPOWNED          0x0001
  288.  
  289.  
  290. UINT WINAPI DdeGetLastError(DWORD idInst);
  291.  
  292. #define     DMLERR_NO_ERROR                    0       /* must be 0 */
  293.  
  294. #define     DMLERR_FIRST                       0x4000
  295.  
  296. #define     DMLERR_ADVACKTIMEOUT               0x4000
  297. #define     DMLERR_BUSY                        0x4001
  298. #define     DMLERR_DATAACKTIMEOUT              0x4002
  299. #define     DMLERR_DLL_NOT_INITIALIZED         0x4003
  300. #define     DMLERR_DLL_USAGE                   0x4004
  301. #define     DMLERR_EXECACKTIMEOUT              0x4005
  302. #define     DMLERR_INVALIDPARAMETER            0x4006
  303. #define     DMLERR_LOW_MEMORY                  0x4007
  304. #define     DMLERR_MEMORY_ERROR                0x4008
  305. #define     DMLERR_NOTPROCESSED                0x4009
  306. #define     DMLERR_NO_CONV_ESTABLISHED         0x400a
  307. #define     DMLERR_POKEACKTIMEOUT              0x400b
  308. #define     DMLERR_POSTMSG_FAILED              0x400c
  309. #define     DMLERR_REENTRANCY                  0x400d
  310. #define     DMLERR_SERVER_DIED                 0x400e
  311. #define     DMLERR_SYS_ERROR                   0x400f
  312. #define     DMLERR_UNADVACKTIMEOUT             0x4010
  313. #define     DMLERR_UNFOUND_QUEUE_ID            0x4011
  314.  
  315. #define     DMLERR_LAST                        0x4011
  316.  
  317. HSZ  WINAPI DdeCreateStringHandleA(DWORD idInst, LPSTR psz, int iCodePage);
  318. HSZ  WINAPI DdeCreateStringHandleW(DWORD idInst, LPWSTR psz, int iCodePage);
  319. #ifdef UNICODE
  320. #define DdeCreateStringHandle DdeCreateStringHandleW
  321. #else
  322. #define DdeCreateStringHandle DdeCreateStringHandleA
  323. #endif // !UNICODE
  324. DWORD WINAPI DdeQueryStringA(DWORD idInst, HSZ hsz, LPSTR psz, DWORD cchMax, int iCodePage);
  325. DWORD WINAPI DdeQueryStringW(DWORD idInst, HSZ hsz, LPWSTR psz, DWORD cchMax, int iCodePage);
  326. #ifdef UNICODE
  327. #define DdeQueryString DdeQueryStringW
  328. #else
  329. #define DdeQueryString DdeQueryStringA
  330. #endif // !UNICODE
  331. BOOL WINAPI DdeFreeStringHandle(DWORD idInst, HSZ hsz);
  332. BOOL WINAPI DdeKeepStringHandle(DWORD idInst, HSZ hsz);
  333. int WINAPI DdeCmpStringHandles(HSZ hsz1, HSZ hsz2);
  334.  
  335.  
  336. #ifndef NODDEMLSPY
  337. /* */
  338. /* DDEML public debugging header file info */
  339. /* */
  340.  
  341. typedef struct tagDDEML_MSG_HOOK_DATA {    // new for NT
  342.     UINT uiLo;      // unpacked lo and hi parts of lParam
  343.     UINT uiHi;
  344.     DWORD cbData;   // amount of data in message, if any. May be > than 32 bytes.
  345.     DWORD Data[8];  // data peeking by DDESPY is limited to 32 bytes.
  346. } DDEML_MSG_HOOK_DATA, *PDDEML_MSG_HOOK_DATA;
  347.  
  348.  
  349. typedef struct tagMONMSGSTRUCT {
  350.     UINT    cb;
  351.     HWND    hwndTo;
  352.     DWORD   dwTime;
  353.     HANDLE  hTask;
  354.     UINT    wMsg;
  355.     WPARAM  wParam;
  356.     LPARAM  lParam;
  357.     DDEML_MSG_HOOK_DATA dmhd;       // new for NT
  358. } MONMSGSTRUCT;
  359.  
  360. typedef struct tagMONCBSTRUCT {
  361.     UINT   cb;
  362.     DWORD  dwTime;
  363.     HANDLE hTask;
  364.     DWORD  dwRet;
  365.     UINT   wType;
  366.     UINT   wFmt;
  367.     HCONV  hConv;
  368.     HSZ    hsz1;
  369.     HSZ    hsz2;
  370.     HDDEDATA hData;
  371.     DWORD  dwData1;
  372.     DWORD  dwData2;
  373.     CONVCONTEXT cc;                 // new for NT for XTYP_CONNECT callbacks
  374.     DWORD  cbData;                  // new for NT for data peeking
  375.     DWORD  Data[8];                 // new for NT for data peeking
  376. } MONCBSTRUCT;
  377.  
  378. typedef struct tagMONHSZSTRUCT {
  379.     UINT   cb;
  380.     BOOL   fsAction;    /* MH_ value */
  381.     DWORD  dwTime;
  382.     HSZ    hsz;
  383.     HANDLE hTask;
  384.     char   str[1];
  385. } MONHSZSTRUCT;
  386.  
  387. #define MH_CREATE   1
  388. #define MH_KEEP     2
  389. #define MH_DELETE   3
  390. #define MH_CLEANUP  4
  391.  
  392. typedef struct tagMONERRSTRUCT {
  393.     UINT    cb;
  394.     UINT    wLastError;
  395.     DWORD   dwTime;
  396.     HANDLE  hTask;
  397. } MONERRSTRUCT;
  398.  
  399. typedef struct tagMONLINKSTRUCT {
  400.     UINT    cb;
  401.     DWORD   dwTime;
  402.     HANDLE  hTask;
  403.     BOOL    fEstablished;
  404.     BOOL    fNoData;
  405.     HSZ     hszSvc;
  406.     HSZ     hszTopic;
  407.     HSZ     hszItem;
  408.     UINT    wFmt;
  409.     BOOL    fServer;
  410.     HCONV   hConvServer;
  411.     HCONV   hConvClient;
  412. } MONLINKSTRUCT;
  413.  
  414. typedef struct tagMONCONVSTRUCT {
  415.     UINT    cb;
  416.     BOOL    fConnect;
  417.     DWORD   dwTime;
  418.     HANDLE  hTask;
  419.     HSZ     hszSvc;
  420.     HSZ     hszTopic;
  421.     HCONV   hConvClient;        // Globally unique value != apps local hConv
  422.     HCONV   hConvServer;        // Globally unique value != apps local hConv
  423. } MONCONVSTRUCT;
  424.  
  425. #define     MAX_MONITORS            4
  426. #define     APPCLASS_MONITOR        0x00000001L
  427. #define     XTYP_MONITOR            (0x00F0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  428.  
  429. /*
  430.  * Callback filter flags for use with MONITOR apps - 0 implies no monitor
  431.  * callbacks.
  432.  */
  433. #define     MF_HSZ_INFO                  0x01000000
  434. #define     MF_SENDMSGS                  0x02000000
  435. #define     MF_POSTMSGS                  0x04000000
  436. #define     MF_CALLBACKS                 0x08000000
  437. #define     MF_ERRORS                    0x10000000
  438. #define     MF_LINKS                     0x20000000
  439. #define     MF_CONV                      0x40000000
  440.  
  441. #define     MF_MASK                      0xFF000000
  442. #endif /* NODDEMLSPY */
  443.  
  444.  
  445. #endif /* _INC_DDEMLH */
  446.  
  447.  
  448.