home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / os2sdk / os2sdk12 / ddeml / msngr / msngr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-22  |  6.9 KB  |  222 lines

  1. /****************************** Module Header ******************************\
  2. * Module Name: MSNGR.H
  3. *
  4. * Created:  12/20/88    sanfords
  5. *
  6. * Copyright (c) 1988, 1989  Microsoft Corporation
  7. \***************************************************************************/
  8. #define INCL_WIN
  9. #define INCL_GPI
  10. #define INCL_DOSNLS
  11. #include "os2.h"
  12. #include "ddeml.h"
  13.  
  14. /****** Resource IDs *****/
  15. #define IDR_MSNGR1         1
  16. #define IDR_MSNGR2         2
  17. #define IDR_SELBMAP        3
  18.  
  19. /****** Control IDs *****/
  20. /* for IDR_MAIN */
  21. #define IDM_SEND           200
  22. #define IDM_DOSENDTEXT     201
  23. #define IDM_DOSENDBITMAP   202
  24. #define IDM_DOSENDSONG     203
  25. #define IDM_INITLINK       204
  26. #define IDM_REGUSER        205
  27.  
  28. #include "dialog.h"
  29.  
  30. /****** string constants *****/
  31.  
  32. #define MAX_NAMESTR         12
  33. #define MAX_TITLEPREFIXSTR  20
  34. #define MAX_TITLESTR        (MAX_NAMESTR + MAX_TITLEPREFIXSTR)
  35. #define MAX_MSGSTR          128
  36. #define MAX_LINKSTR         256
  37. #define MAX_CAPTIONSTR      32
  38. #define MAX_EXECSTR         32
  39.  
  40. #define SZAPPCLASS         "Messenger"
  41. #define SZAPPTITLEPREFIX   "Messenger for "
  42. #define SZDUPTITLE         "Duplicate Name..."
  43. #define SZMAKESELECTION    "You must select someone."
  44. #define SZCANTCONNECT      "Error: I can't connect you."
  45. #define SZEMPTYMSG         "Can't send an empty Message."
  46. #define SZSENDFAILED       "Send Operation failed."
  47. #define SZMSGIN            "Message received from "
  48. #define SZNOTIFYCAPTION    "___Messenger Notification___"
  49. #define SZBADCOMPARAMS     "Command parameters not recognized."
  50. #define SZMEMORYERROR      "A memory error occurred."
  51. #define SZALREADYLINKED    "You are already linked"
  52. #define SZLINKED           "-- Linked --"
  53. #define SZCANTLINK         "Link attempt failed."
  54. #define SZINTERNALERROR    "Internal Error"
  55. #define SZMSGLINKWITH      "'s Link With "
  56. #define SZLINKBROKEN       "The link has been externally broken."
  57. #define SZTOOBIG           "The selected area is too big."
  58.  
  59. /* DDE topics and items for this application. */
  60. /*  Note that system topic strings are in ddeml.h. */
  61. #define     SZDDEAPPNAME   "Messenger Application"
  62. #define     SZDDEMSGTOPIC  "Messages Topic"
  63. #define     SZUSERNAME     "User Name"
  64. #define     SZMESSAGEDATA  "Message Data"
  65. #define     SZLINKDATA     "Link Data"
  66. #define     SZBMAPDATA     "Bitmap Data"
  67.  
  68. /* used for execute DDE message */
  69. #define SZNAMEINSTRUCT     "Email name setup"
  70.  
  71. /* class names for this app */
  72. #define SZENHANCEDEFCLASS  "EnhancedEFClass"
  73. #define SZHOLDINGCLASS     "HoldingClass"
  74.  
  75. /* topicList index constants */
  76. #define ITL_SYS     0
  77. #define ITL_MSG     1
  78. #define ITL_LAST    1
  79.  
  80. /* itemList lengths and constants */
  81. #define IIL_SYSLAST     4
  82. #define IIL_MSGUSERNAME 0
  83. #define IIL_MSGXFER     1
  84. #define IIL_BMPXFER     2
  85. #define IIL_MSGLAST     2
  86.  
  87. /* window ids */
  88. #define WID_NOTIFY1 41
  89. #define WID_NOTIFY2 42
  90. #define WID_LISTBOX 43
  91.  
  92. #define DEFTIMEOUT  2000L
  93.  
  94. /****** Private window messages *****/
  95. #define UM_MSG_NOTIFY   WM_USER
  96. #define UM_DESTRUCT     (WM_USER + 1)
  97. #define UM_LINKEVENT    (WM_USER + 2)
  98. #define UM_LINK1        (WM_USER + 3)
  99. #define UM_DOADVSTART   (WM_USER + 4)
  100. #define UM_ADVRCVD      (WM_USER + 5)
  101. #define UM_LINKDATAIN     (WM_USER + 6)
  102. #define UM_BREAKLINK  (WM_USER + 7)
  103. #define UM_LINKDATAOUT  (WM_USER + 8)
  104. #define ENHAN_ENTER     (WM_USER + 9)
  105.  
  106. /****** link states ******/
  107. #define LNKST_USERSTART     0
  108. #define LNKST_DMGSTART      1
  109. #define LNKST_UNLINKED      2
  110. #define LNKST_LINKREQ       3
  111. #define LNKST_LINKED        4
  112. #define LNKST_UNLNKREQ      5
  113.  
  114. /****** Structrues ******/
  115.  
  116. typedef struct _XFERINFO {
  117.     HDMGDATA hDmgData;
  118.     USHORT usType;
  119.     USHORT usFmt;
  120.     HSZ hszItem;
  121.     HSZ hszTopic;
  122.     HCONV hConv;
  123. } XFERINFO;
  124. typedef XFERINFO FAR *PXFERINFO;
  125.  
  126. typedef struct _USERLIST {
  127.     struct _USERLIST        *next;
  128.     HCONV                   hConvMsg;
  129.     HCONV                   hConvLink;
  130.     HSZ                     hsz;
  131.     HWND                    hwndLink;
  132.     HAPP                    hApp;
  133. } USERLIST;
  134. typedef USERLIST *NPUSERLIST;
  135. typedef NPUSERLIST FAR *PNPUSERLIST;
  136.  
  137. typedef struct _ITEMLIST {
  138.     HSZ hszItem;
  139.     HDMGDATA (*npfnCallback)(PXFERINFO);
  140.     PSZ pszItem;
  141. } ITEMLIST;
  142.  
  143. typedef struct _TOPICLIST {
  144.     HSZ hszTopic;
  145.     ITEMLIST *pItemList;
  146.     USHORT iItemLast;
  147.     PSZ pszTopic;
  148. } TOPICLIST;
  149.  
  150.  
  151.  
  152. /****** globals ******/
  153.  
  154. extern HHEAP hheap;
  155.  
  156.  
  157. /****** MACROS *****/
  158.  
  159. #define min(a,b)    (a > b ? b : a)
  160. #define NOTIFYOWNER(hwnd, msg, mp1, mp2) \
  161.             (WinSendMsg(WinQueryWindow(hwnd, QW_OWNER, FALSE), msg, mp1, mp2))
  162. #define UNUSED
  163.  
  164.  
  165. /************* PROCEDURE DECLARATIONS   *************/
  166. /* from msngr.c */
  167.  
  168. void cdecl main(int argc, char *argv[]);
  169. MRESULT EXPENTRY MainWndProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2);
  170. MRESULT EXPENTRY GetNameDlgProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2);
  171. MRESULT EXPENTRY EnhancedEFWndProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2);
  172. MRESULT EXPENTRY SendTextDlgProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2);
  173. MRESULT EXPENTRY SendBitmapDlgProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2);
  174. MRESULT EXPENTRY SendSongDlgProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2);
  175. HDMGDATA EXPENTRY Callback(HCONV hConv, HSZ hszTopic, HSZ hszItem,
  176.         USHORT usFmt, USHORT usType, HDMGDATA hDmgData);
  177. HDMGDATA TopicListXfer(PXFERINFO pXferInfo);
  178. HDMGDATA ItemListXfer(PXFERINFO pXferInfo);
  179. HDMGDATA NotSupported(PXFERINFO pXferInfo);
  180. HDMGDATA sysFormatsXfer(PXFERINFO pXferInfo);
  181. HDMGDATA msgUserNameXfer(PXFERINFO pXferInfo);
  182. HDMGDATA msgMessageXfer(PXFERINFO pXferInfo);
  183. void CheckForDups(HWND hwndLB);
  184. void Hszize(void);
  185. void UnHszize(void);
  186. NPUSERLIST AccessSelection(void);
  187. void MyPostErr(USHORT err);
  188. BOOL RegisterUser(HAPP hApp, HDMGDATA hData, BOOL fRegister);
  189. BOOL UnregisterUser(HAPP);
  190. VOID SetEmailName(PSZ psz);
  191. void NotifyUser(PSZ psz);
  192. void NotifyUser2(PSZ pszCaption, PSZ pszText);
  193.  
  194. extern ULONG ulTimeout;
  195.  
  196. /* from link.c */
  197. BOOL CreateLinkWindow(NPUSERLIST pUserItem, USHORT state);
  198. MRESULT EXPENTRY LinkDlgProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2);
  199. HDMGDATA LinkXfer(PXFERINFO pXferInfo, HSZ hszPartner);
  200.  
  201. /* from util.c */
  202. void lstrcat(PSZ pszDest, PSZ psz1, PSZ psz2);
  203. void lstrcpy(PSZ pszDst, PSZ pszSrc);
  204. void lstrpak(PSZ pszDest, PSZ psz1, PSZ psz2);
  205. int lstrlen(PSZ psz);
  206. void DestroyUser(NPUSERLIST npUL);
  207. VOID AddUser(HCONV hConvMsg, HSZ hsz, HAPP hApp);
  208. HCONV HszTohConvMsg(NPUSERLIST pList, HSZ hsz);
  209. NPUSERLIST FindUser(NPUSERLIST pList, HSZ hsz);
  210. void freeUserList(PNPUSERLIST ppList);
  211. PVOID FarAllocMem(HHEAP hheap, USHORT cb);
  212. void MyPostError(USHORT err);
  213.  
  214. /* from bmap.c */
  215. void InitBmapModule(void);
  216. void CloseBmapModule(void);
  217. HDMGDATA bmpXfer(PXFERINFO pXferInfo);
  218. MRESULT EXPENTRY BmpDlgProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2);
  219. MRESULT EXPENTRY SendBitmapDlgProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2);
  220.  
  221.  
  222.