home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 14.ddi / GENINC.PAK / DDEML.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  32.2 KB  |  945 lines

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