home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 6.ddi / WINCLUDE.ZIP / DDEML.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  15.6 KB  |  462 lines

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