home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / dbmsg / mapi / route.cli / client.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-11  |  9.9 KB  |  315 lines

  1. /*
  2.  -  C L I E N T . H
  3.  -
  4.  *  Purpose:
  5.  *      Header file for the sample mail client based on Extended MAPI.
  6.  *
  7.  *      Copyright 1995, Microsoft Corporation. All Rights Reserved.
  8.  */
  9.  
  10. #ifndef __CLIENT_H__
  11. #define __CLIENT_H__
  12.  
  13.  
  14. /* Menu Item IDs */
  15.  
  16. #define IDM_LOGON       100
  17. #define IDM_LOGOFF      101
  18. #define IDM_EXIT        102
  19. #define IDM_READ        103
  20. #define IDM_SEND        104
  21. #define IDM_ABOUT       105
  22. #define IDM_OPEN        106
  23. #define IDM_HIER        107
  24.  
  25. #define IDM_ROUTE       108
  26.  
  27. #define IDM_NEWFORM     109
  28. /* Resource IDs */
  29.  
  30. #define ICON_NOMAIL     200
  31. #define ICON_MAIL       201
  32. #define IDB_ENVELOPE    300
  33.  
  34.  
  35. /* Address Book Control IDs */
  36.  
  37. #define IDT_ADDRESS     101
  38. #define IDC_ADDRESS     102
  39. #define IDT_LIST        103
  40. #define IDC_LIST        104
  41. #define IDC_ADD         105
  42. #define IDC_REMOVE      106
  43.  
  44.  
  45. /* Compose Note Control IDs */
  46.  
  47. #define IDC_SEND        101
  48. #define IDC_RESOLVE     102
  49. #define IDC_ATTACH      103
  50. #define IDC_OPTIONS     104
  51. #define IDC_ADDRBOOK    105
  52. #define IDT_TO          106
  53. #define IDC_TO          107
  54. #define IDT_CC          108
  55. #define IDC_CC          109
  56. #define IDT_SUBJECT     110
  57. #define IDC_SUBJECT     111
  58. #define IDC_NOTE        112
  59. #define IDC_LINE1       -1
  60. #define IDC_LINE2       -1
  61. #define IDC_CATTACHMENT 113
  62. #define IDT_CATTACHMENT -1
  63.  
  64.  
  65. #define IDC_ADDROUTESLIP 115
  66.  
  67. //RouteNote control IDs
  68. #define IDC_RTCC            101
  69. #define IDT_RTCC            -1
  70. #define IDT_RTSUBJECT           -1
  71. #define IDC_RTSUBJECT           102
  72. #define IDC_RTNOTE          103
  73. #define IDC_RTROUTE         104
  74. #define IDC_RTATTACH            105
  75. #define IDC_RTEDITROUTESLIP 106
  76. #define IDC_RTATTACHLIST        107
  77. #define IDT_RTATTACHLIST        108
  78. #define IDC_RTSAVEATTACH        109
  79. #define IDC_RTDELATTACH         110
  80.  
  81. /* InBox Control IDs */
  82.  
  83. #define IDT_MSG         101
  84. #define IDC_MSG         102
  85. #define IDC_NEW         103
  86. #define IDC_READ        104
  87. #define IDC_DELETE      105
  88. #define IDC_CLOSE       106
  89. #define IDC_DOWN                107     // Hierarchy Table only
  90. #define IDC_FLUSH       108
  91.  
  92. /* ReadNote Control IDs */
  93.  
  94. #define IDC_SAVECHANGES 101
  95. #define IDC_SAVEATTACH  102
  96. #define IDC_REPLY       103
  97. #define IDC_REPLYALL    104
  98. #define IDC_FORWARD     105
  99. #define IDT_RFROM       106
  100. #define IDT_RDATE       107
  101. #define IDT_RTO         108
  102. #define IDT_RCC         109
  103. #define IDT_RSUBJECT    110
  104. #define IDC_RFROM       111
  105. #define IDC_RDATE       112
  106. #define IDC_RTO         113
  107. #define IDC_RCC         114
  108. #define IDC_RSUBJECT    115
  109. #define IDC_READNOTE    116
  110. #define IDT_ATTACHMENT  117
  111. #define IDC_ATTACHMENT  118
  112.  
  113.  
  114. /* Options Control IDs */
  115.  
  116. #define IDC_RETURN      101
  117.  
  118.  
  119. /* Details Control IDs */
  120.  
  121. #define IDT_NAME        100
  122. #define IDC_NAME        101
  123. #define IDT_TYPE        102
  124. #define IDC_TYPE        103
  125. #define IDT_ADDR        104
  126. #define IDC_ADDR        105
  127.  
  128. /* About Box Control IDs */
  129.  
  130. #define IDC_VERSION             101
  131.  
  132.  
  133.  
  134. /* Route Box Control IDs*/
  135.  
  136. #define IDC_ROUTE               100            
  137. #define IDC_ADDRLISTOLD         101
  138. #define IDC_ADDRLISTACTIVE      102
  139. #define IDC_ADDADDR             103
  140. #define IDC_REMOVEADDR          104
  141. #define IDC_MOVEUP              105
  142. #define IDC_MOVEDOWN            106
  143. #define IDC_STATIC                      -1
  144.  
  145. #define LENGTHOLD        80
  146. #define LENGTHACTIVE 80
  147. #define LBLENGTH (LENGTHOLD + LENGTHACTIVE) /*sum of the lengths of the two listboxes in RouteNote DlgBox*/
  148. #define DELTA 5  /*distance between the bottom of the first LB and the top of the second
  149.                     DELATA is not used directly in the .rc file. it has to be calculated manualy*/
  150. #define LBX 70  /* The x coordinate of the left edges of the listboxes*/
  151. #define DELTAX 140 /*the width of the listboxes*/
  152. #define OLDY   5        /*the y coordinate of the top of the first listbox*/
  153. #define MINY   40 /*the min height of a listbox*/
  154.  
  155.  
  156.  
  157. /* String Table IDs */
  158.  
  159. #define MAPI_ERROR_MAX          30
  160.  
  161. #define IDS_LOGONFAIL           (MAPI_ERROR_MAX + 1)
  162. #define IDS_ADDRBOOKFAIL        (MAPI_ERROR_MAX + 2)
  163. #define IDS_RESOLVEFAIL         (MAPI_ERROR_MAX + 3)
  164. #define IDS_UNRESOLVEDNAMES     (MAPI_ERROR_MAX + 4)
  165. #define IDS_SENDERROR           (MAPI_ERROR_MAX + 5)
  166. #define IDS_DETAILS_TOO_MANY    (MAPI_ERROR_MAX + 6)
  167. #define IDS_DETAILSFAIL         (MAPI_ERROR_MAX + 7)
  168. #define IDS_NORECIPS            (MAPI_ERROR_MAX + 8)
  169. #define IDS_SAVEATTACHERROR     (MAPI_ERROR_MAX + 9)
  170. #define IDS_READFAIL            (MAPI_ERROR_MAX + 10)
  171. #define IDS_STORETBLFAIL        (MAPI_ERROR_MAX + 11)
  172. #define IDS_QUERYROWFAIL        (MAPI_ERROR_MAX + 12)
  173. #define IDS_OPENSTOREFAIL       (MAPI_ERROR_MAX + 13)
  174. #define IDS_STATUSTBLFAIL       (MAPI_ERROR_MAX + 14)
  175. #define IDS_OPENFOLDERFAIL      (MAPI_ERROR_MAX + 15)
  176. #define IDS_GETRCVFAIL          (MAPI_ERROR_MAX + 16)
  177. #define IDS_SETRCVFAIL          (MAPI_ERROR_MAX + 17)
  178. #define IDS_SETPROPFAIL         (MAPI_ERROR_MAX + 18)
  179. #define IDS_NOENTRYID           (MAPI_ERROR_MAX + 19)
  180. #define IDS_OPERATION           (MAPI_ERROR_MAX + 20)
  181. #define IDS_NODEFAULTSTORE      (MAPI_ERROR_MAX + 21)
  182. #define IDS_SETCOLFAIL          (MAPI_ERROR_MAX + 22)
  183. #define IDS_CRTOUTMSG                   (MAPI_ERROR_MAX + 23)
  184. #define IDS_SHOWFORM                    (MAPI_ERROR_MAX + 24)
  185. #define IDS_OPENAB                              (MAPI_ERROR_MAX + 25)
  186. #define IDS_INIDIAG                             (MAPI_ERROR_MAX + 26)
  187. #define IDS_UNXERR                              (MAPI_ERROR_MAX + 27)
  188. #define IDS_OPENOUTF                    (MAPI_ERROR_MAX + 28)
  189. #define IDS_MAPIINIF                    (MAPI_ERROR_MAX + 29)
  190. #define IDS_OPENSTOREWARN               (MAPI_ERROR_MAX + 30)
  191. #define IDS_OPENABWARN                  (MAPI_ERROR_MAX + 31)
  192. #define IDS_LASTRECIP                   (MAPI_ERROR_MAX + 32)
  193.  
  194. #define IDS_IPM                 (MAPI_ERROR_MAX + 42)
  195. #define IDS_IPM_COMMENT         (MAPI_ERROR_MAX + 43)
  196. #define IDS_INBOX               (MAPI_ERROR_MAX + 44)
  197. #define IDS_INBOX_COMMENT       (MAPI_ERROR_MAX + 45)
  198. #define IDS_OUTBOX              (MAPI_ERROR_MAX + 46)
  199. #define IDS_OUTBOX_COMMENT      (MAPI_ERROR_MAX + 47)
  200. #define IDS_SENTMAIL            (MAPI_ERROR_MAX + 48)
  201. #define IDS_SENTMAIL_COMMENT    (MAPI_ERROR_MAX + 49)
  202. #define IDS_FILTER              (MAPI_ERROR_MAX + 50)
  203. #define IDS_OPENOUTB                    (MAPI_ERROR_MAX + 51)
  204.  
  205. /* Manifest Constants */
  206.  
  207. #define MBS_ERROR           (MB_ICONSTOP | MB_OK)
  208. #define MBS_INFO            (MB_ICONINFORMATION | MB_OK)
  209. #define MBS_OOPS            (MB_ICONEXCLAMATION | MB_OK)
  210.  
  211. /* Structure Definitions */
  212.  
  213. typedef struct _msgid *LPMSGID;
  214.  
  215. typedef struct _msgid
  216. {
  217.     ULONG           cbEID;
  218.     LPENTRYID       lpEID;
  219.     BOOL        fHasAttach;
  220.     BOOL        fUnRead;
  221.     LPSTR       lpszFrom;
  222.     LPSTR       lpszSubject;
  223.     LPSTR       lpszDateRec;
  224.     LPMSGID     lpPrev;
  225.     LPMSGID     lpNext;
  226. } MSGID;
  227.  
  228. typedef struct _inboxdata
  229. {
  230.     LPMSGID         lpMsgIdList;
  231.     LPMAPIFOLDER pfld;
  232. } INBOXDATA, FAR * LPINBOXDATA;
  233.  
  234.  
  235. typedef struct _oar *LPOAR;
  236.  
  237. typedef struct _oar
  238. {
  239.     LPOAR                   lpNext;
  240.     LPOAR                   lpPrev;
  241.     ULONG                   cValues;
  242.     LPSPropValue    lpProps;
  243. } OAR;
  244.  
  245. /* Types of MAPI Tables shown by common dialog */
  246. enum {
  247.     iStores,
  248.     iHierarchy
  249. };
  250.  
  251. /* Data structure used by CommonDlgProc */
  252. typedef struct {
  253.     int             iDlgType;       // dialog type.  see "enum" above
  254.     LPOAR           poarHead;       // chain of rows within the dialog
  255.     ULONG           cbEntryID;
  256.     LPENTRYID       lpEntryID;
  257. } DIALOGDATA, FAR * LPDIALOGDATA;
  258.  
  259.  
  260.  
  261. /* Globals */
  262. extern LPMAPISESSION pses;
  263. extern LPADRBOOK pabAddrB;
  264. extern LPMDB pmdb;
  265. extern HANDLE hInst;
  266. extern HCURSOR hWaitCur;
  267. extern LPMAPIFOLDER pfldOutBox;
  268. extern LPSPropValue pvalSentMailEID;
  269. /* Function Prototypes */
  270.  
  271. int  PASCAL WinMain(HINSTANCE, HINSTANCE, LPSTR, int);
  272. BOOL InitApplication(HANDLE);
  273. BOOL InitInstance(HANDLE, int);
  274. void DeinitApplication(void);
  275. BOOL ClientLogon(HWND);
  276. VOID ClientLogoff(HWND);
  277. BOOL InitMAPI (HWND);
  278. void DeinitMAPI();
  279. LPMDB OpenDefaultStore(HWND); 
  280. long FAR PASCAL MainWndProc(HWND, UINT, UINT, LPARAM);
  281. BOOL CALLBACK CommonDlgProc(HWND, UINT, WPARAM, LPARAM);
  282. BOOL CALLBACK InBoxDlgProc(HWND, UINT, WPARAM, LPARAM);
  283. BOOL CALLBACK AboutDlgProc(HWND, UINT, WPARAM, LPARAM);
  284. BOOL CALLBACK ComposeDlgProc(HWND, UINT, WPARAM, LPARAM);
  285. BOOL CALLBACK ReadMailDlgProc(HWND, UINT, WPARAM, LPARAM);
  286. BOOL CALLBACK OptionsDlgProc(HWND, UINT, WPARAM, LPARAM);
  287. BOOL CALLBACK DetailsDlgProc(HWND, UINT, WPARAM, LPARAM);
  288. void    MakeMessageBox(HWND, SCODE, UINT, LPMAPIERROR, UINT);
  289. HRESULT HrCreateChildFolder (HWND, LPMAPIFOLDER, ULONG, ULONG, LPTSTR, ULONG, LPMAPIFOLDER FAR *);
  290. VOID    PopulateStores ( HWND hDlg, LPOAR FAR * ppoarHead, int idlgType, ULONG cb, LPENTRYID lpeid);
  291. VOID    FreeOarList (LPOAR FAR *ppoarHead);
  292. VOID    DrawOarItem (DRAWITEMSTRUCT FAR * pdis, int idlgType);
  293. VOID    PopulateMessages( HWND hDlg, LPINBOXDATA pibData );
  294. LPMSGID MakeMsgNode(LPSRow);
  295. LPMSGID FindNode (LPMSGID lpMsgHead, LPENTRYID pEntryID, ULONG cbEntryID);
  296. void    InsertMsgNode(LPMSGID, LPMSGID *);
  297. void    DeleteMsgNode(LPMSGID, LPMSGID *);
  298. void    FreeMsgList(LPMSGID);
  299. void    LogSendMail(ULONG);
  300. void    ToggleMenuState(HWND, BOOL);   
  301. void    FormatMessageID(ULONG, LPBYTE, LPSTR);
  302. void    FormatFILETIME(FILETIME *, LPSTR);
  303. LPDIALOGDATA CreateDialogData(int iDlgType);
  304. BOOL READ_OnCommand(HWND hDlg, int id, HWND hwndCtl, UINT codeNotify);
  305. BOOL READ_OnInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lParam);
  306. void INBOX_OnCommand(HWND hDlg, int id, HWND hwndCtl, UINT codeNotify);
  307. LONG MAIN_OnCommand(HWND hWnd, int id, HWND hwndCtl, UINT codeNotify);
  308. BOOL Common_OnCommand(HWND hDlg, int id, HWND hwndCtl, UINT codeNotify);
  309. HRESULT DeliverNow(HWND hWnd);
  310. void SecureMenu(HWND hWnd, BOOL fBeforeLogon);
  311.  
  312.  
  313.  
  314. #endif 
  315.