home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / msinc.pak / DDEML.H < prev    next >
C/C++ Source or Header  |  1997-07-23  |  34KB  |  973 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. *  ddeml.h -    DDEML API header file                                         *
  4. *                                                                             *
  5. \*****************************************************************************/
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 6.5
  9.  *
  10.  *      Copyright (c) 1994 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14.  
  15. #if !defined(__FLAT__)
  16. /*****************************************************************************\
  17. *                                                                             *
  18. *  ddeml.h -    DDEML API header file                                         *
  19. *                                                                             *
  20. \*****************************************************************************/
  21.  
  22. #ifndef __DDEML_H       /* prevent multiple includes */
  23. #define __DDEML_H
  24.  
  25. #ifndef __WINDOWS_H
  26. #include <windows.h>    /* <windows.h> must be included */
  27. #endif  /* __WINDOWS_H */
  28.  
  29. #ifndef RC_INVOKED
  30. #pragma option -a-      /* Assume byte packing throughout */
  31. #endif  /* RC_INVOKED */
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {            /* Assume C declarations for C++ */
  35. #endif /* __cplusplus */
  36.  
  37. /* If included with the 3.0 windows.h, define compatible aliases */
  38. #if !defined(WINVER) || (WINVER < 0x030a)
  39. #define LPCSTR      LPSTR
  40. #define WINAPI      FAR PASCAL
  41. #define CALLBACK    FAR PASCAL
  42. #define UINT        WORD
  43. #define LPARAM      LONG
  44. #define WPARAM      WORD
  45. #define LRESULT     LONG
  46. #define HMODULE     HANDLE
  47. #define HINSTANCE   HANDLE
  48. #define HLOCAL      HANDLE
  49. #define HGLOBAL     HANDLE
  50. #endif  /* WIN3.0 */
  51.  
  52. #ifndef DECLARE_HANDLE32
  53. #ifdef STRICT
  54. #define DECLARE_HANDLE32(name)  struct name##__ { int unused; }; \
  55.                                 typedef const struct name##__ _far* name
  56. #else   /* STRICT */
  57. #define DECLARE_HANDLE32(name)  typedef DWORD name
  58. #endif  /* !STRICT */
  59. #endif  /* !DECLARE_HANDLE32 */
  60.  
  61. #define EXPENTRY    WINAPI
  62.  
  63. /******** public types ********/
  64.  
  65. DECLARE_HANDLE32(HCONVLIST);
  66. DECLARE_HANDLE32(HCONV);
  67. DECLARE_HANDLE32(HDDEDATA);
  68. #if !defined(_HSZ_DEFINED)
  69. #define _HSZ_DEFINED
  70. DECLARE_HANDLE32(HSZ);
  71. #endif
  72.  
  73. /* the following structure is for use with XTYP_WILDCONNECT processing. */
  74.  
  75. typedef struct tagHSZPAIR
  76. {
  77.     HSZ hszSvc;
  78.     HSZ hszTopic;
  79. } HSZPAIR;
  80. typedef HSZPAIR FAR *PHSZPAIR;
  81.  
  82. /* The following structure is used by DdeConnect() and DdeConnectList() and
  83.    by XTYP_CONNECT and XTYP_WILDCONNECT callbacks. */
  84.  
  85. typedef struct tagCONVCONTEXT
  86. {
  87.     UINT        cb;             /* set to sizeof(CONVCONTEXT) */
  88.     UINT        wFlags;         /* none currently defined. */
  89.     UINT        wCountryID;     /* country code for topic/item strings used. */
  90.     int         iCodePage;      /* codepage used for topic/item strings. */
  91.     DWORD       dwLangID;       /* language ID for topic/item strings. */
  92.     DWORD       dwSecurity;     /* Private security code. */
  93. } CONVCONTEXT;
  94. typedef CONVCONTEXT FAR *PCONVCONTEXT;
  95.  
  96. /* The following structure is used by DdeQueryConvInfo(): */
  97.  
  98. typedef struct tagCONVINFO
  99. {
  100.     DWORD   cb;            /* sizeof(CONVINFO)  */
  101.     DWORD   hUser;         /* user specified field  */
  102.     HCONV   hConvPartner;  /* hConv on other end or 0 if non-ddemgr partner  */
  103.     HSZ     hszSvcPartner; /* app name of partner if obtainable  */
  104.     HSZ     hszServiceReq; /* AppName requested for connection  */
  105.     HSZ     hszTopic;      /* Topic name for conversation  */
  106.     HSZ     hszItem;       /* transaction item name or NULL if quiescent  */
  107.     UINT    wFmt;          /* transaction format or NULL if quiescent  */
  108.     UINT    wType;         /* XTYP_ for current transaction  */
  109.     UINT    wStatus;       /* ST_ constant for current conversation  */
  110.     UINT    wConvst;       /* XST_ constant for current transaction  */
  111.     UINT    wLastError;    /* last transaction error.  */
  112.     HCONVLIST hConvList;   /* parent hConvList if this conversation is in a list */
  113.     CONVCONTEXT ConvCtxt;  /* conversation context */
  114. } CONVINFO;
  115. typedef CONVINFO FAR *PCONVINFO;
  116.  
  117. /***** conversation states (usState) *****/
  118.  
  119. #define     XST_NULL              0  /* quiescent states */
  120. #define     XST_INCOMPLETE        1
  121. #define     XST_CONNECTED         2
  122. #define     XST_INIT1             3  /* mid-initiation states */
  123. #define     XST_INIT2             4
  124. #define     XST_REQSENT           5  /* active conversation states */
  125. #define     XST_DATARCVD          6
  126. #define     XST_POKESENT          7
  127. #define     XST_POKEACKRCVD       8
  128. #define     XST_EXECSENT          9
  129. #define     XST_EXECACKRCVD      10
  130. #define     XST_ADVSENT          11
  131. #define     XST_UNADVSENT        12
  132. #define     XST_ADVACKRCVD       13
  133. #define     XST_UNADVACKRCVD     14
  134. #define     XST_ADVDATASENT      15
  135. #define     XST_ADVDATAACKRCVD   16
  136.  
  137. /* used in LOWORD(dwData1) of XTYP_ADVREQ callbacks... */
  138. #define     CADV_LATEACK         0xFFFF
  139.  
  140. /***** conversation status bits (fsStatus) *****/
  141.  
  142. #define     ST_CONNECTED        0x0001
  143. #define     ST_ADVISE           0x0002
  144. #define     ST_ISLOCAL          0x0004
  145. #define     ST_BLOCKED          0x0008
  146. #define     ST_CLIENT           0x0010
  147. #define     ST_TERMINATED       0x0020
  148. #define     ST_INLIST           0x0040
  149. #define     ST_BLOCKNEXT        0x0080
  150. #define     ST_ISSELF           0x0100
  151.  
  152. /* DDE constants for wStatus field */
  153.  
  154. #define DDE_FACK                0x8000
  155. #define DDE_FBUSY               0x4000
  156. #define DDE_FDEFERUPD           0x4000
  157. #define DDE_FACKREQ             0x8000
  158. #define DDE_FRELEASE            0x2000
  159. #define DDE_FREQUESTED          0x1000
  160. #define DDE_FACKRESERVED        0x3ff0
  161. #define DDE_FADVRESERVED        0x3fff
  162. #define DDE_FDATRESERVED        0x4fff
  163. #define DDE_FPOKRESERVED        0xdfff
  164. #define DDE_FAPPSTATUS          0x00ff
  165. #define DDE_FNOTPROCESSED       0x0000
  166.  
  167. /***** message filter hook types *****/
  168.  
  169. #define     MSGF_DDEMGR             0x8001
  170.  
  171. /***** codepage constants ****/
  172.  
  173. #define CP_WINANSI      1004    /* default codepage for windows & old DDE convs. */
  174.  
  175. /***** transaction types *****/
  176.  
  177. #define     XTYPF_NOBLOCK            0x0002  /* CBR_BLOCK will not work */
  178. #define     XTYPF_NODATA             0x0004  /* DDE_FDEFERUPD */
  179. #define     XTYPF_ACKREQ             0x0008  /* DDE_FACKREQ */
  180.  
  181. #define     XCLASS_MASK              0xFC00
  182. #define     XCLASS_BOOL              0x1000
  183. #define     XCLASS_DATA              0x2000
  184. #define     XCLASS_FLAGS             0x4000
  185. #define     XCLASS_NOTIFICATION      0x8000
  186.  
  187. #define     XTYP_ERROR              (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
  188. #define     XTYP_ADVDATA            (0x0010 | XCLASS_FLAGS         )
  189. #define     XTYP_ADVREQ             (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK )
  190. #define     XTYP_ADVSTART           (0x0030 | XCLASS_BOOL          )
  191. #define     XTYP_ADVSTOP            (0x0040 | XCLASS_NOTIFICATION)
  192. #define     XTYP_EXECUTE            (0x0050 | XCLASS_FLAGS         )
  193. #define     XTYP_CONNECT            (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
  194. #define     XTYP_CONNECT_CONFIRM    (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  195. #define     XTYP_XACT_COMPLETE      (0x0080 | XCLASS_NOTIFICATION  )
  196. #define     XTYP_POKE               (0x0090 | XCLASS_FLAGS         )
  197. #define     XTYP_REGISTER           (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  198. #define     XTYP_REQUEST            (0x00B0 | XCLASS_DATA          )
  199. #define     XTYP_DISCONNECT         (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  200. #define     XTYP_UNREGISTER         (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  201. #define     XTYP_WILDCONNECT        (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
  202.  
  203. #define     XTYP_MASK                0x00F0
  204. #define     XTYP_SHIFT               0x0004  /* shift to turn XTYP_ into an index */
  205.  
  206. /***** Timeout constants *****/
  207.  
  208. #define     TIMEOUT_ASYNC           -1L
  209.  
  210. /***** Transaction ID constants *****/
  211.  
  212. #define     QID_SYNC                -1L
  213.  
  214. /****** public strings used in DDE ******/
  215.  
  216. #define SZDDESYS_TOPIC          "System"
  217. #define SZDDESYS_ITEM_TOPICS    "Topics"
  218. #define SZDDESYS_ITEM_SYSITEMS  "SysItems"
  219. #define SZDDESYS_ITEM_RTNMSG    "ReturnMessage"
  220. #define SZDDESYS_ITEM_STATUS    "Status"
  221. #define SZDDESYS_ITEM_FORMATS   "Formats"
  222. #define SZDDESYS_ITEM_HELP      "Help"
  223. #define SZDDE_ITEM_ITEMLIST     "TopicItemList"
  224.  
  225.  
  226. /****** API entry points ******/
  227.  
  228. typedef HDDEDATA CALLBACK FNCALLBACK(UINT wType, UINT wFmt, HCONV hConv,
  229.         HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1, DWORD dwData2);
  230. typedef FNCALLBACK *PFNCALLBACK;
  231.  
  232. #define     CBR_BLOCK                0xffffffffL
  233.  
  234. /* DLL registration functions */
  235.  
  236. UINT    WINAPI DdeInitialize(DWORD FAR* pidInst, PFNCALLBACK pfnCallback,
  237.                 DWORD afCmd, DWORD ulRes);
  238.  
  239. /*
  240.  * Callback filter flags for use with standard apps.
  241.  */
  242.  
  243. #define     CBF_FAIL_SELFCONNECTIONS     0x00001000L
  244. #define     CBF_FAIL_CONNECTIONS         0x00002000L
  245. #define     CBF_FAIL_ADVISES             0x00004000L
  246. #define     CBF_FAIL_EXECUTES            0x00008000L
  247. #define     CBF_FAIL_POKES               0x00010000L
  248. #define     CBF_FAIL_REQUESTS            0x00020000L
  249. #define     CBF_FAIL_ALLSVRXACTIONS      0x0003f000L
  250.  
  251. #define     CBF_SKIP_CONNECT_CONFIRMS    0x00040000L
  252. #define     CBF_SKIP_REGISTRATIONS       0x00080000L
  253. #define     CBF_SKIP_UNREGISTRATIONS     0x00100000L
  254. #define     CBF_SKIP_DISCONNECTS         0x00200000L
  255. #define     CBF_SKIP_ALLNOTIFICATIONS    0x003c0000L
  256.  
  257. /*
  258.  * Application command flags
  259.  */
  260. #define     APPCMD_CLIENTONLY            0x00000010L
  261. #define     APPCMD_FILTERINITS           0x00000020L
  262. #define     APPCMD_MASK                  0x00000FF0L
  263.  
  264. /*
  265.  * Application classification flags
  266.  */
  267. #define     APPCLASS_STANDARD            0x00000000L
  268. #define     APPCLASS_MASK                0x0000000FL
  269.  
  270.  
  271. BOOL    WINAPI DdeUninitialize(DWORD idInst);
  272.  
  273. /* conversation enumeration functions */
  274.  
  275. HCONVLIST WINAPI DdeConnectList(DWORD idInst, HSZ hszService, HSZ hszTopic,
  276.             HCONVLIST hConvList, CONVCONTEXT FAR* pCC);
  277. HCONV   WINAPI DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev);
  278. BOOL    WINAPI DdeDisconnectList(HCONVLIST hConvList);
  279.  
  280. /* conversation control functions */
  281.  
  282. HCONV   WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic,
  283.             CONVCONTEXT FAR* pCC);
  284. BOOL    WINAPI DdeDisconnect(HCONV hConv);
  285. HCONV   WINAPI DdeReconnect(HCONV hConv);
  286.  
  287. UINT    WINAPI DdeQueryConvInfo(HCONV hConv, DWORD idTransaction, CONVINFO FAR* pConvInfo);
  288. BOOL    WINAPI DdeSetUserHandle(HCONV hConv, DWORD id, DWORD hUser);
  289.  
  290. BOOL    WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction);
  291.  
  292.  
  293. /* app server interface functions */
  294.  
  295. BOOL    WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem);
  296. BOOL    WINAPI DdeEnableCallback(DWORD idInst, HCONV hConv, UINT wCmd);
  297.  
  298. #define EC_ENABLEALL            0
  299. #define EC_ENABLEONE            ST_BLOCKNEXT
  300. #define EC_DISABLE              ST_BLOCKED
  301. #define EC_QUERYWAITING         2
  302.  
  303. HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd);
  304.  
  305. #define DNS_REGISTER        0x0001
  306. #define DNS_UNREGISTER      0x0002
  307. #define DNS_FILTERON        0x0004
  308. #define DNS_FILTEROFF       0x0008
  309.  
  310. /* app client interface functions */
  311.  
  312. HDDEDATA WINAPI DdeClientTransaction(void FAR* pData, DWORD cbData,
  313.         HCONV hConv, HSZ hszItem, UINT wFmt, UINT wType,
  314.         DWORD dwTimeout, DWORD FAR* pdwResult);
  315.  
  316. /* data transfer functions */
  317.  
  318. HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, void FAR* pSrc, DWORD cb,
  319.             DWORD cbOff, HSZ hszItem, UINT wFmt, UINT afCmd);
  320. HDDEDATA WINAPI DdeAddData(HDDEDATA hData, void FAR* pSrc, DWORD cb, DWORD cbOff);
  321. DWORD   WINAPI DdeGetData(HDDEDATA hData, void FAR* pDst, DWORD cbMax, DWORD cbOff);
  322. BYTE FAR* WINAPI DdeAccessData(HDDEDATA hData, DWORD FAR* pcbDataSize);
  323. BOOL    WINAPI DdeUnaccessData(HDDEDATA hData);
  324. BOOL    WINAPI DdeFreeDataHandle(HDDEDATA hData);
  325.  
  326. #define     HDATA_APPOWNED          0x0001
  327.  
  328.  
  329.  
  330. UINT WINAPI DdeGetLastError(DWORD idInst);
  331.  
  332. #define     DMLERR_NO_ERROR                    0       /* must be 0 */
  333.  
  334. #define     DMLERR_FIRST                       0x4000
  335.  
  336. #define     DMLERR_ADVACKTIMEOUT               0x4000
  337. #define     DMLERR_BUSY                        0x4001
  338. #define     DMLERR_DATAACKTIMEOUT              0x4002
  339. #define     DMLERR_DLL_NOT_INITIALIZED         0x4003
  340. #define     DMLERR_DLL_USAGE                   0x4004
  341. #define     DMLERR_EXECACKTIMEOUT              0x4005
  342. #define     DMLERR_INVALIDPARAMETER            0x4006
  343. #define     DMLERR_LOW_MEMORY                  0x4007
  344. #define     DMLERR_MEMORY_ERROR                0x4008
  345. #define     DMLERR_NOTPROCESSED                0x4009
  346. #define     DMLERR_NO_CONV_ESTABLISHED         0x400a
  347. #define     DMLERR_POKEACKTIMEOUT              0x400b
  348. #define     DMLERR_POSTMSG_FAILED              0x400c
  349. #define     DMLERR_REENTRANCY                  0x400d
  350. #define     DMLERR_SERVER_DIED                 0x400e
  351. #define     DMLERR_SYS_ERROR                   0x400f
  352. #define     DMLERR_UNADVACKTIMEOUT             0x4010
  353. #define     DMLERR_UNFOUND_QUEUE_ID            0x4011
  354.  
  355. #define     DMLERR_LAST                        0x4011
  356.  
  357. HSZ     WINAPI DdeCreateStringHandle(DWORD idInst, LPCSTR psz, int iCodePage);
  358. DWORD   WINAPI DdeQueryString(DWORD idInst, HSZ hsz, LPSTR psz, DWORD cchMax, int iCodePage);
  359. BOOL    WINAPI DdeFreeStringHandle(DWORD idInst, HSZ hsz);
  360. BOOL    WINAPI DdeKeepStringHandle(DWORD idInst, HSZ hsz);
  361. int     WINAPI DdeCmpStringHandles(HSZ hsz1, HSZ hsz2);
  362.  
  363.  
  364. #ifndef NODDEMLSPY
  365. /* */
  366. /* DDEML public debugging header file info */
  367. /* */
  368.  
  369. typedef struct tagMONMSGSTRUCT
  370. {
  371.     UINT    cb;
  372.     HWND    hwndTo;
  373.     DWORD   dwTime;
  374.     HANDLE  hTask;
  375.     UINT    wMsg;
  376.     WPARAM  wParam;
  377.     LPARAM  lParam;
  378. } MONMSGSTRUCT;
  379.  
  380. typedef struct tagMONCBSTRUCT
  381. {
  382.     UINT   cb;
  383.     WORD   wReserved;
  384.     DWORD  dwTime;
  385.     HANDLE hTask;
  386.     DWORD  dwRet;
  387.     UINT   wType;
  388.     UINT   wFmt;
  389.     HCONV  hConv;
  390.     HSZ    hsz1;
  391.     HSZ    hsz2;
  392.     HDDEDATA hData;
  393.     DWORD  dwData1;
  394.     DWORD  dwData2;
  395. } MONCBSTRUCT;
  396.  
  397. typedef struct tagMONHSZSTRUCT
  398. {
  399.     UINT   cb;
  400.     BOOL   fsAction;    /* MH_ value */
  401.     DWORD  dwTime;
  402.     HSZ    hsz;
  403.     HANDLE hTask;
  404.     WORD   wReserved;
  405.     char   str[1];
  406. } MONHSZSTRUCT;
  407.  
  408. #define MH_CREATE   1
  409. #define MH_KEEP     2
  410. #define MH_DELETE   3
  411. #define MH_CLEANUP  4
  412.  
  413.  
  414. typedef struct tagMONERRSTRUCT
  415. {
  416.     UINT    cb;
  417.     UINT    wLastError;
  418.     DWORD   dwTime;
  419.     HANDLE  hTask;
  420. } MONERRSTRUCT;
  421.  
  422. typedef struct tagMONLINKSTRUCT
  423. {
  424.     UINT    cb;
  425.     DWORD   dwTime;
  426.     HANDLE  hTask;
  427.     BOOL    fEstablished;
  428.     BOOL    fNoData;
  429.     HSZ     hszSvc;
  430.     HSZ     hszTopic;
  431.     HSZ     hszItem;
  432.     UINT    wFmt;
  433.     BOOL    fServer;
  434.     HCONV   hConvServer;
  435.     HCONV   hConvClient;
  436. } MONLINKSTRUCT;
  437.  
  438. typedef struct tagMONCONVSTRUCT
  439. {
  440.     UINT    cb;
  441.     BOOL    fConnect;
  442.     DWORD   dwTime;
  443.     HANDLE  hTask;
  444.     HSZ     hszSvc;
  445.     HSZ     hszTopic;
  446.     HCONV   hConvClient;
  447.     HCONV   hConvServer;
  448. } MONCONVSTRUCT;
  449.  
  450. #define     MAX_MONITORS            4
  451. #define     APPCLASS_MONITOR        0x00000001L
  452. #define     XTYP_MONITOR            (0x00F0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  453.  
  454. /*
  455.  * Callback filter flags for use with MONITOR apps - 0 implies no monitor
  456.  * callbacks.
  457.  */
  458. #define     MF_HSZ_INFO                  0x01000000L
  459. #define     MF_SENDMSGS                  0x02000000L
  460. #define     MF_POSTMSGS                  0x04000000L
  461. #define     MF_CALLBACKS                 0x08000000L
  462. #define     MF_ERRORS                    0x10000000L
  463. #define     MF_LINKS                     0x20000000L
  464. #define     MF_CONV                      0x40000000L
  465.  
  466. #define     MF_MASK                      0xFF000000L
  467. #endif /* NODDEMLSPY */
  468.  
  469. #ifdef __cplusplus
  470. }                       /* End of extern "C" { */
  471. #endif  /* __cplusplus */
  472.  
  473. #ifndef RC_INVOKED
  474. #pragma option -a.      /* Revert to default packing */
  475. #endif  /* RC_INVOKED */
  476.  
  477. #endif  /* __DDEML_H */
  478. #else  /* !__FLAT__ */
  479. /*++ BUILD Version: 0001 // Increment this if a change has global effects --*/
  480.  
  481. /*****************************************************************************\
  482. *                                                                             *
  483. *  ddeml.h -    DDEML API header file                                         *
  484. *                                                                             *
  485. *               Version 3.10                                                  *
  486. *                                                                             *
  487. *               Copyright (c) 1993-95, Microsoft Corp.  All rights reserved.  *
  488. *                                                                             *
  489. \*****************************************************************************/
  490. #ifndef _INC_DDEMLH
  491. #define _INC_DDEMLH
  492.  
  493. #ifdef __cplusplus
  494. extern "C" {
  495. #endif /* __cplusplus */
  496.  
  497. /******** public types ********/
  498.  
  499. DECLARE_HANDLE(HCONVLIST);
  500. DECLARE_HANDLE(HCONV);
  501. DECLARE_HANDLE(HSZ);
  502. // Used by BIVBX
  503. #define _HSZ_DEFINED
  504.  
  505. DECLARE_HANDLE(HDDEDATA);
  506. #define EXPENTRY        CALLBACK
  507.  
  508. /* the following structure is for use with XTYP_WILDCONNECT processing. */
  509.  
  510. typedef struct tagHSZPAIR {
  511.     HSZ hszSvc;
  512.     HSZ hszTopic;
  513. } HSZPAIR;
  514. typedef HSZPAIR FAR *PHSZPAIR;
  515.  
  516. /* The following structure is used by DdeConnect() and DdeConnectList() and
  517.    by XTYP_CONNECT and XTYP_WILDCONNECT callbacks. */
  518.  
  519. typedef struct tagCONVCONTEXT {
  520.     UINT        cb;             /* set to sizeof(CONVCONTEXT) */
  521.     UINT        wFlags;         /* none currently defined. */
  522.     UINT        wCountryID;     /* country code for topic/item strings used. */
  523.     int         iCodePage;      /* codepage used for topic/item strings. */
  524.     DWORD       dwLangID;       /* language ID for topic/item strings. */
  525.     DWORD       dwSecurity;     /* Private security code. */
  526.     SECURITY_QUALITY_OF_SERVICE qos;  /* client side's quality of service */
  527. } CONVCONTEXT;
  528. typedef CONVCONTEXT FAR *PCONVCONTEXT;
  529.  
  530.  
  531. /* The following structure is used by DdeQueryConvInfo(): */
  532.  
  533. typedef struct tagCONVINFO {
  534.     DWORD   cb;            /* sizeof(CONVINFO)  */
  535.     DWORD   hUser;         /* user specified field  */
  536.     HCONV   hConvPartner;  /* hConv on other end or 0 if non-ddemgr partner  */
  537.     HSZ     hszSvcPartner; /* app name of partner if obtainable  */
  538.     HSZ     hszServiceReq; /* AppName requested for connection  */
  539.     HSZ     hszTopic;      /* Topic name for conversation  */
  540.     HSZ     hszItem;       /* transaction item name or NULL if quiescent  */
  541.     UINT    wFmt;          /* transaction format or NULL if quiescent  */
  542.     UINT    wType;         /* XTYP_ for current transaction  */
  543.     UINT    wStatus;       /* ST_ constant for current conversation  */
  544.     UINT    wConvst;       /* XST_ constant for current transaction  */
  545.     UINT    wLastError;    /* last transaction error.  */
  546.     HCONVLIST hConvList;   /* parent hConvList if this conversation is in a list */
  547.     CONVCONTEXT ConvCtxt;  /* conversation context */
  548.     HWND    hwnd;          /* window handle for this conversation */
  549.     HWND    hwndPartner;   /* partner window handle for this conversation */
  550. } CONVINFO;
  551. typedef CONVINFO FAR *PCONVINFO;
  552.  
  553. /***** conversation states (usState) *****/
  554.  
  555. #define     XST_NULL              0  /* quiescent states */
  556. #define     XST_INCOMPLETE        1
  557. #define     XST_CONNECTED         2
  558. #define     XST_INIT1             3  /* mid-initiation states */
  559. #define     XST_INIT2             4
  560. #define     XST_REQSENT           5  /* active conversation states */
  561. #define     XST_DATARCVD          6
  562. #define     XST_POKESENT          7
  563. #define     XST_POKEACKRCVD       8
  564. #define     XST_EXECSENT          9
  565. #define     XST_EXECACKRCVD      10
  566. #define     XST_ADVSENT          11
  567. #define     XST_UNADVSENT        12
  568. #define     XST_ADVACKRCVD       13
  569. #define     XST_UNADVACKRCVD     14
  570. #define     XST_ADVDATASENT      15
  571. #define     XST_ADVDATAACKRCVD   16
  572.  
  573. /* used in LOWORD(dwData1) of XTYP_ADVREQ callbacks... */
  574. #define     CADV_LATEACK         0xFFFF
  575.  
  576. /***** conversation status bits (fsStatus) *****/
  577.  
  578. #define     ST_CONNECTED            0x0001
  579. #define     ST_ADVISE               0x0002
  580. #define     ST_ISLOCAL              0x0004
  581. #define     ST_BLOCKED              0x0008
  582. #define     ST_CLIENT               0x0010
  583. #define     ST_TERMINATED           0x0020
  584. #define     ST_INLIST               0x0040
  585. #define     ST_BLOCKNEXT            0x0080
  586. #define     ST_ISSELF               0x0100
  587.  
  588.  
  589. /* DDE constants for wStatus field */
  590.  
  591. #define DDE_FACK                0x8000
  592. #define DDE_FBUSY               0x4000
  593. #define DDE_FDEFERUPD           0x4000
  594. #define DDE_FACKREQ             0x8000
  595. #define DDE_FRELEASE            0x2000
  596. #define DDE_FREQUESTED          0x1000
  597. #define DDE_FAPPSTATUS          0x00ff
  598. #define DDE_FNOTPROCESSED       0x0000
  599.  
  600. #define DDE_FACKRESERVED        (~(DDE_FACK | DDE_FBUSY | DDE_FAPPSTATUS))
  601. #define DDE_FADVRESERVED        (~(DDE_FACKREQ | DDE_FDEFERUPD))
  602. #define DDE_FDATRESERVED        (~(DDE_FACKREQ | DDE_FRELEASE | DDE_FREQUESTED))
  603. #define DDE_FPOKRESERVED        (~(DDE_FRELEASE))
  604.  
  605. /***** message filter hook types *****/
  606.  
  607. #define     MSGF_DDEMGR             0x8001
  608.  
  609. /***** codepage constants ****/
  610.  
  611. #define CP_WINANSI      1004    /* default codepage for windows & old DDE convs. */
  612. #define CP_WINUNICODE   1200
  613.  
  614. /***** transaction types *****/
  615.  
  616. #define     XTYPF_NOBLOCK            0x0002  /* CBR_BLOCK will not work */
  617. #define     XTYPF_NODATA             0x0004  /* DDE_FDEFERUPD */
  618. #define     XTYPF_ACKREQ             0x0008  /* DDE_FACKREQ */
  619.  
  620. #define     XCLASS_MASK              0xFC00
  621. #define     XCLASS_BOOL              0x1000
  622. #define     XCLASS_DATA              0x2000
  623. #define     XCLASS_FLAGS             0x4000
  624. #define     XCLASS_NOTIFICATION      0x8000
  625.  
  626. #define     XTYP_ERROR              (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
  627. #define     XTYP_ADVDATA            (0x0010 | XCLASS_FLAGS         )
  628. #define     XTYP_ADVREQ             (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK )
  629. #define     XTYP_ADVSTART           (0x0030 | XCLASS_BOOL          )
  630. #define     XTYP_ADVSTOP            (0x0040 | XCLASS_NOTIFICATION)
  631. #define     XTYP_EXECUTE            (0x0050 | XCLASS_FLAGS         )
  632. #define     XTYP_CONNECT            (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
  633. #define     XTYP_CONNECT_CONFIRM    (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  634. #define     XTYP_XACT_COMPLETE      (0x0080 | XCLASS_NOTIFICATION  )
  635. #define     XTYP_POKE               (0x0090 | XCLASS_FLAGS         )
  636. #define     XTYP_REGISTER           (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  637. #define     XTYP_REQUEST            (0x00B0 | XCLASS_DATA          )
  638. #define     XTYP_DISCONNECT         (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  639. #define     XTYP_UNREGISTER         (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  640. #define     XTYP_WILDCONNECT        (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
  641.  
  642. #define     XTYP_MASK                0x00F0
  643. #define     XTYP_SHIFT               4  /* shift to turn XTYP_ into an index */
  644.  
  645. /***** Timeout constants *****/
  646.  
  647. #define     TIMEOUT_ASYNC           0xFFFFFFFF
  648.  
  649. /***** Transaction ID constants *****/
  650.  
  651. #define     QID_SYNC                0xFFFFFFFF
  652.  
  653. /****** public strings used in DDE ******/
  654.  
  655. #ifdef UNICODE
  656. #define SZDDESYS_TOPIC         L"System"
  657. #define SZDDESYS_ITEM_TOPICS   L"Topics"
  658. #define SZDDESYS_ITEM_SYSITEMS L"SysItems"
  659. #define SZDDESYS_ITEM_RTNMSG   L"ReturnMessage"
  660. #define SZDDESYS_ITEM_STATUS   L"Status"
  661. #define SZDDESYS_ITEM_FORMATS  L"Formats"
  662. #define SZDDESYS_ITEM_HELP     L"Help"
  663. #define SZDDE_ITEM_ITEMLIST    L"TopicItemList"
  664. #else
  665. #define SZDDESYS_TOPIC         "System"
  666. #define SZDDESYS_ITEM_TOPICS   "Topics"
  667. #define SZDDESYS_ITEM_SYSITEMS "SysItems"
  668. #define SZDDESYS_ITEM_RTNMSG   "ReturnMessage"
  669. #define SZDDESYS_ITEM_STATUS   "Status"
  670. #define SZDDESYS_ITEM_FORMATS  "Formats"
  671. #define SZDDESYS_ITEM_HELP     "Help"
  672. #define SZDDE_ITEM_ITEMLIST    "TopicItemList"
  673. #endif
  674.  
  675.  
  676. /****** API entry points ******/
  677.  
  678. typedef HDDEDATA CALLBACK FNCALLBACK(UINT wType, UINT wFmt, HCONV hConv,
  679.         HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1, DWORD dwData2);
  680. typedef HDDEDATA (CALLBACK *PFNCALLBACK)(UINT wType, UINT wFmt, HCONV hConv,
  681.         HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1, DWORD dwData2);
  682.  
  683. #define     CBR_BLOCK           ((HDDEDATA)0xffffffffL)
  684.  
  685. /* DLL registration functions */
  686.  
  687. UINT WINAPI DdeInitializeA(LPDWORD pidInst, PFNCALLBACK pfnCallback,
  688.         DWORD afCmd, DWORD ulRes);
  689. UINT WINAPI DdeInitializeW(LPDWORD pidInst, PFNCALLBACK pfnCallback,
  690.         DWORD afCmd, DWORD ulRes);
  691. #ifdef UNICODE
  692. #define DdeInitialize  DdeInitializeW
  693. #else
  694. #define DdeInitialize  DdeInitializeA
  695. #endif // !UNICODE
  696.  
  697. /*
  698.  * Callback filter flags for use with standard apps.
  699.  */
  700.  
  701. #define     CBF_FAIL_SELFCONNECTIONS     0x00001000
  702. #define     CBF_FAIL_CONNECTIONS         0x00002000
  703. #define     CBF_FAIL_ADVISES             0x00004000
  704. #define     CBF_FAIL_EXECUTES            0x00008000
  705. #define     CBF_FAIL_POKES               0x00010000
  706. #define     CBF_FAIL_REQUESTS            0x00020000
  707. #define     CBF_FAIL_ALLSVRXACTIONS      0x0003f000
  708.  
  709. #define     CBF_SKIP_CONNECT_CONFIRMS    0x00040000
  710. #define     CBF_SKIP_REGISTRATIONS       0x00080000
  711. #define     CBF_SKIP_UNREGISTRATIONS     0x00100000
  712. #define     CBF_SKIP_DISCONNECTS         0x00200000
  713. #define     CBF_SKIP_ALLNOTIFICATIONS    0x003c0000
  714.  
  715. /*
  716.  * Application command flags
  717.  */
  718. #define     APPCMD_CLIENTONLY            0x00000010L
  719. #define     APPCMD_FILTERINITS           0x00000020L
  720. #define     APPCMD_MASK                  0x00000FF0L
  721.  
  722. /*
  723.  * Application classification flags
  724.  */
  725. #define     APPCLASS_STANDARD            0x00000000L
  726. #define     APPCLASS_MASK                0x0000000FL
  727.  
  728.  
  729.  
  730. BOOL WINAPI DdeUninitialize(DWORD idInst);
  731.  
  732. /*
  733.  * conversation enumeration functions
  734.  */
  735.  
  736. HCONVLIST WINAPI DdeConnectList(DWORD idInst, HSZ hszService, HSZ hszTopic,
  737.         HCONVLIST hConvList, PCONVCONTEXT pCC);
  738. HCONV WINAPI DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev);
  739. BOOL WINAPI DdeDisconnectList(HCONVLIST hConvList);
  740.  
  741. /*
  742.  * conversation control functions
  743.  */
  744.  
  745. HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic,
  746.         PCONVCONTEXT pCC);
  747. BOOL WINAPI DdeDisconnect(HCONV hConv);
  748. HCONV WINAPI DdeReconnect(HCONV hConv);
  749. UINT WINAPI DdeQueryConvInfo(HCONV hConv, DWORD idTransaction, PCONVINFO pConvInfo);
  750. BOOL WINAPI DdeSetUserHandle(HCONV hConv, DWORD id, DWORD hUser);
  751. BOOL WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction);
  752.  
  753.  
  754. /*
  755.  * app server interface functions
  756.  */
  757.  
  758. BOOL WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem);
  759. BOOL WINAPI DdeEnableCallback(DWORD idInst, HCONV hConv, UINT wCmd);
  760. BOOL WINAPI DdeImpersonateClient(HCONV hConv);
  761.  
  762. #define EC_ENABLEALL            0
  763. #define EC_ENABLEONE            ST_BLOCKNEXT
  764. #define EC_DISABLE              ST_BLOCKED
  765. #define EC_QUERYWAITING         2
  766.  
  767.  
  768. HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd);
  769.  
  770. #define DNS_REGISTER        0x0001
  771. #define DNS_UNREGISTER      0x0002
  772. #define DNS_FILTERON        0x0004
  773. #define DNS_FILTEROFF       0x0008
  774.  
  775. /*
  776.  * app client interface functions
  777.  */
  778.  
  779. HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData,
  780.         HCONV hConv, HSZ hszItem, UINT wFmt, UINT wType,
  781.         DWORD dwTimeout, LPDWORD pdwResult);
  782.  
  783. /*
  784.  *data transfer functions
  785.  */
  786.  
  787. HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb,
  788.         DWORD cbOff, HSZ hszItem, UINT wFmt, UINT afCmd);
  789. HDDEDATA WINAPI DdeAddData(HDDEDATA hData, LPBYTE pSrc, DWORD cb, DWORD cbOff);
  790. DWORD WINAPI DdeGetData(HDDEDATA hData, LPBYTE pDst, DWORD cbMax, DWORD cbOff);
  791. LPBYTE WINAPI DdeAccessData(HDDEDATA hData, LPDWORD pcbDataSize);
  792. BOOL WINAPI DdeUnaccessData(HDDEDATA hData);
  793. BOOL WINAPI DdeFreeDataHandle(HDDEDATA hData);
  794.  
  795. #define     HDATA_APPOWNED          0x0001
  796.  
  797.  
  798. UINT WINAPI DdeGetLastError(DWORD idInst);
  799.  
  800. #define     DMLERR_NO_ERROR                    0       /* must be 0 */
  801.  
  802. #define     DMLERR_FIRST                       0x4000
  803.  
  804. #define     DMLERR_ADVACKTIMEOUT               0x4000
  805. #define     DMLERR_BUSY                        0x4001
  806. #define     DMLERR_DATAACKTIMEOUT              0x4002
  807. #define     DMLERR_DLL_NOT_INITIALIZED         0x4003
  808. #define     DMLERR_DLL_USAGE                   0x4004
  809. #define     DMLERR_EXECACKTIMEOUT              0x4005
  810. #define     DMLERR_INVALIDPARAMETER            0x4006
  811. #define     DMLERR_LOW_MEMORY                  0x4007
  812. #define     DMLERR_MEMORY_ERROR                0x4008
  813. #define     DMLERR_NOTPROCESSED                0x4009
  814. #define     DMLERR_NO_CONV_ESTABLISHED         0x400a
  815. #define     DMLERR_POKEACKTIMEOUT              0x400b
  816. #define     DMLERR_POSTMSG_FAILED              0x400c
  817. #define     DMLERR_REENTRANCY                  0x400d
  818. #define     DMLERR_SERVER_DIED                 0x400e
  819. #define     DMLERR_SYS_ERROR                   0x400f
  820. #define     DMLERR_UNADVACKTIMEOUT             0x4010
  821. #define     DMLERR_UNFOUND_QUEUE_ID            0x4011
  822.  
  823. #define     DMLERR_LAST                        0x4011
  824.  
  825. HSZ  WINAPI DdeCreateStringHandleA(DWORD idInst, LPCSTR psz, int iCodePage);
  826. HSZ  WINAPI DdeCreateStringHandleW(DWORD idInst, LPCWSTR psz, int iCodePage);
  827. #ifdef UNICODE
  828. #define DdeCreateStringHandle  DdeCreateStringHandleW
  829. #else
  830. #define DdeCreateStringHandle  DdeCreateStringHandleA
  831. #endif // !UNICODE
  832. DWORD WINAPI DdeQueryStringA(DWORD idInst, HSZ hsz, LPSTR psz, DWORD cchMax, int iCodePage);
  833. DWORD WINAPI DdeQueryStringW(DWORD idInst, HSZ hsz, LPWSTR psz, DWORD cchMax, int iCodePage);
  834. #ifdef UNICODE
  835. #define DdeQueryString  DdeQueryStringW
  836. #else
  837. #define DdeQueryString  DdeQueryStringA
  838. #endif // !UNICODE
  839. BOOL WINAPI DdeFreeStringHandle(DWORD idInst, HSZ hsz);
  840. BOOL WINAPI DdeKeepStringHandle(DWORD idInst, HSZ hsz);
  841. int WINAPI DdeCmpStringHandles(HSZ hsz1, HSZ hsz2);
  842.  
  843.  
  844. #ifndef NODDEMLSPY
  845. /*
  846.  * DDEML public debugging header file info
  847.  */
  848.  
  849. typedef struct tagDDEML_MSG_HOOK_DATA {    // new for NT
  850.     UINT uiLo;      // unpacked lo and hi parts of lParam
  851.     UINT uiHi;
  852.     DWORD cbData;   // amount of data in message, if any. May be > than 32 bytes.
  853.     DWORD Data[8];  // data peeking by DDESPY is limited to 32 bytes.
  854. } DDEML_MSG_HOOK_DATA, *PDDEML_MSG_HOOK_DATA;
  855.  
  856.  
  857. typedef struct tagMONMSGSTRUCT {
  858.     UINT    cb;
  859.     HWND    hwndTo;
  860.     DWORD   dwTime;
  861.     HANDLE  hTask;
  862.     UINT    wMsg;
  863.     WPARAM  wParam;
  864.     LPARAM  lParam;
  865.     DDEML_MSG_HOOK_DATA dmhd;       // new for NT
  866. } MONMSGSTRUCT, *PMONMSGSTRUCT;
  867.  
  868. typedef struct tagMONCBSTRUCT {
  869.     UINT   cb;
  870.     DWORD  dwTime;
  871.     HANDLE hTask;
  872.     DWORD  dwRet;
  873.     UINT   wType;
  874.     UINT   wFmt;
  875.     HCONV  hConv;
  876.     HSZ    hsz1;
  877.     HSZ    hsz2;
  878.     HDDEDATA hData;
  879.     DWORD  dwData1;
  880.     DWORD  dwData2;
  881.     CONVCONTEXT cc;                 // new for NT for XTYP_CONNECT callbacks
  882.     DWORD  cbData;                  // new for NT for data peeking
  883.     DWORD  Data[8];                 // new for NT for data peeking
  884. } MONCBSTRUCT, *PMONCBSTRUCT;
  885.  
  886. typedef struct tagMONHSZSTRUCTA {
  887.     UINT   cb;
  888.     BOOL   fsAction;    /* MH_ value */
  889.     DWORD  dwTime;
  890.     HSZ    hsz;
  891.     HANDLE hTask;
  892.     CHAR    str[1];
  893. } MONHSZSTRUCTA, *PMONHSZSTRUCTA;
  894. typedef struct tagMONHSZSTRUCTW {
  895.     UINT   cb;
  896.     BOOL   fsAction;    /* MH_ value */
  897.     DWORD  dwTime;
  898.     HSZ    hsz;
  899.     HANDLE hTask;
  900.     WCHAR   str[1];
  901. } MONHSZSTRUCTW, *PMONHSZSTRUCTW;
  902. #ifdef UNICODE
  903. typedef MONHSZSTRUCTW MONHSZSTRUCT;
  904. typedef PMONHSZSTRUCTW PMONHSZSTRUCT;
  905. #else
  906. typedef MONHSZSTRUCTA MONHSZSTRUCT;
  907. typedef PMONHSZSTRUCTA PMONHSZSTRUCT;
  908. #endif // UNICODE
  909.  
  910. #define MH_CREATE   1
  911. #define MH_KEEP     2
  912. #define MH_DELETE   3
  913. #define MH_CLEANUP  4
  914.  
  915. typedef struct tagMONERRSTRUCT {
  916.     UINT    cb;
  917.     UINT    wLastError;
  918.     DWORD   dwTime;
  919.     HANDLE  hTask;
  920. } MONERRSTRUCT, *PMONERRSTRUCT;
  921.  
  922. typedef struct tagMONLINKSTRUCT {
  923.     UINT    cb;
  924.     DWORD   dwTime;
  925.     HANDLE  hTask;
  926.     BOOL    fEstablished;
  927.     BOOL    fNoData;
  928.     HSZ     hszSvc;
  929.     HSZ     hszTopic;
  930.     HSZ     hszItem;
  931.     UINT    wFmt;
  932.     BOOL    fServer;
  933.     HCONV   hConvServer;
  934.     HCONV   hConvClient;
  935. } MONLINKSTRUCT, *PMONLINKSTRUCT;
  936.  
  937. typedef struct tagMONCONVSTRUCT {
  938.     UINT    cb;
  939.     BOOL    fConnect;
  940.     DWORD   dwTime;
  941.     HANDLE  hTask;
  942.     HSZ     hszSvc;
  943.     HSZ     hszTopic;
  944.     HCONV   hConvClient;        // Globally unique value != apps local hConv
  945.     HCONV   hConvServer;        // Globally unique value != apps local hConv
  946. } MONCONVSTRUCT, *PMONCONVSTRUCT;
  947.  
  948. #define     MAX_MONITORS            4
  949. #define     APPCLASS_MONITOR        0x00000001L
  950. #define     XTYP_MONITOR            (0x00F0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
  951.  
  952. /*
  953.  * Callback filter flags for use with MONITOR apps - 0 implies no monitor
  954.  * callbacks.
  955.  */
  956. #define     MF_HSZ_INFO                  0x01000000
  957. #define     MF_SENDMSGS                  0x02000000
  958. #define     MF_POSTMSGS                  0x04000000
  959. #define     MF_CALLBACKS                 0x08000000
  960. #define     MF_ERRORS                    0x10000000
  961. #define     MF_LINKS                     0x20000000
  962. #define     MF_CONV                      0x40000000
  963.  
  964. #define     MF_MASK                      0xFF000000
  965. #endif /* NODDEMLSPY */
  966.  
  967. #ifdef __cplusplus
  968. }
  969. #endif  /* __cplusplus */
  970.  
  971. #endif /* _INC_DDEMLH */
  972. #endif  /* __FLAT__ */
  973.