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 / cmc.cli / cmccli.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-11  |  8.9 KB  |  324 lines

  1. /*
  2.  -  C M C C L I . H
  3.  -
  4.  *  Purpose:
  5.  *      Header file for the sample mail client based on CMC.
  6.  *
  7.  */
  8.  
  9. #ifndef CMC_H
  10. //#include <xcmc.h>
  11. #endif
  12.  
  13. #ifndef ULONG
  14. typedef unsigned long ULONG;
  15. #endif
  16.  
  17. /* Menu Item IDs */
  18.  
  19. #define IDM_LOGON           100
  20. #define IDM_LOGOFF          101
  21. #define IDM_EXIT            102
  22. #define IDM_COMPOSE_CMC     103
  23. #define IDM_COMPOSE_CUSTOM  104
  24. #define IDM_READ            105
  25. #define IDM_ADDRBOOK        106
  26. #define IDM_ABOUT           107
  27.  
  28. /* Resource IDs */
  29.  
  30. #define ICON_NOMAIL     200
  31. #define ICON_MAIL       201
  32. #define IDREAD          300
  33. #define IDREADA         301
  34. #define IDUNREAD        302
  35. #define IDUNREADA       303
  36.  
  37.  
  38. /* Address Book Control IDs */
  39.  
  40. #define IDT_ADDRESS     101
  41. #define IDC_ADDRESS     102
  42. #define IDT_LIST        103
  43. #define IDC_LIST        104
  44. #define IDC_ADD         105
  45. #define IDC_REMOVE      106
  46.  
  47.  
  48. /* Compose Note Control IDs */
  49.  
  50. #define IDC_SEND        101
  51. #define IDC_RESOLVE     102
  52. #define IDC_ATTACH      103
  53. #define IDC_OPTIONS     104
  54. #define IDC_ADDRBOOK    105
  55. #define IDT_TO          106
  56. #define IDC_TO          107
  57. #define IDT_CC          108
  58. #define IDC_CC          109
  59. #define IDT_SUBJECT     110
  60. #define IDC_SUBJECT     111
  61. #define IDC_NOTE        112
  62. #define IDC_LINE1       113
  63. #define IDC_LINE2       114
  64.  
  65.  
  66. /* InBox Control IDs */
  67.  
  68. #define IDT_MSG         101
  69. #define IDC_MSG         102
  70. #define IDC_NEW         103
  71. #define IDC_READ        104
  72. #define IDC_DELETE      105
  73. #define IDC_CLOSE       106
  74.  
  75.  
  76. /* ReadNote Control IDs */
  77.  
  78. #define IDC_SAVECHANGES 101
  79. #define IDC_SAVEATTACH  102
  80. #define IDC_REPLY       103
  81. #define IDC_REPLYALL    104
  82. #define IDC_FORWARD     105
  83. #define IDT_RFROM       106
  84. #define IDT_RDATE       107
  85. #define IDT_RTO         108
  86. #define IDT_RCC         109
  87. #define IDT_RSUBJECT    110
  88. #define IDC_RFROM       111
  89. #define IDC_RDATE       112
  90. #define IDC_RTO         113
  91. #define IDC_RCC         114
  92. #define IDC_RSUBJECT    115
  93. #define IDC_READNOTE    116
  94. #define IDT_ATTACHMENT  117
  95. #define IDC_ATTACHMENT  118
  96. #define IDC_LINE3       119
  97. #define IDC_LINE4       120
  98.  
  99.  
  100. /* Options Control IDs */
  101.  
  102. #define IDC_RETURN      101
  103. #define IDC_PRIORITY    102
  104. #define IDC_URGENT      103
  105. #define IDC_NORMAL      104
  106. #define IDC_LOW         105
  107.  
  108.  
  109. /* About Box Control IDs */
  110.  
  111. #define IDC_VERSION     101
  112. #define IDC_STATIC1     102
  113. #define IDC_STATIC2     103
  114. #define IDC_STATIC3     104
  115.  
  116.  
  117. /* String Table IDs */
  118.  
  119. #define CMC_E_MAX 40
  120.  
  121. #define IDS_LOGONFAIL           (CMC_E_MAX + 1)
  122. #define IDS_ADDRBOOKFAIL        (CMC_E_MAX + 2)
  123. #define IDS_RESOLVEFAIL         (CMC_E_MAX + 3)
  124. #define IDS_UNRESOLVEDNAMES     (CMC_E_MAX + 4)
  125. #define IDS_SENDERROR           (CMC_E_MAX + 5)
  126. #define IDS_NORECIPS            (CMC_E_MAX + 6)
  127. #define IDS_SAVEATTACHERROR     (CMC_E_MAX + 7)
  128. #define IDS_READFAIL            (CMC_E_MAX + 8)
  129. #define IDS_MAKENEWFAIL         (CMC_E_MAX + 9)
  130.  
  131. #define IDS_FILTER              (CMC_E_MAX + 50)
  132.  
  133. /* Manifest Constants */
  134.  
  135. #define ADDR_MAX            128
  136. #define MAXUSERS            10
  137. #define TO_EDIT_MAX         512
  138. #define CC_EDIT_MAX         512
  139. #define SUBJECT_EDIT_MAX    128
  140. #define NOTE_LINE_MAX       1024
  141. #define FILE_ATTACH_MAX     32
  142.  
  143. /* Message Box styles */
  144.  
  145. #define MBS_ERROR           (MB_ICONSTOP | MB_OK)
  146. #define MBS_INFO            (MB_ICONINFORMATION | MB_OK)
  147. #define MBS_OOPS            (MB_ICONEXCLAMATION | MB_OK)
  148.  
  149. /* Structure Definitions */
  150.  
  151. typedef struct _msgid FAR *LPMSGID;
  152.  
  153. typedef struct _msgid
  154. {
  155.     CMC_message_reference   *message_reference;
  156.     CMC_string              from;
  157.     CMC_string              subject;
  158.     CMC_time                time_sent;
  159.     CMC_boolean             fHasAttach;
  160.     CMC_boolean             fRead;
  161.     LPMSGID                 lpPrev;
  162.     LPMSGID                 lpNext;
  163. } MSGID;
  164.  
  165. /* Function Prototypes */
  166.  
  167. int  PASCAL WinMain(HINSTANCE, HINSTANCE, LPSTR, int);
  168. BOOL InitApplication(HINSTANCE);
  169. BOOL InitInstance(HINSTANCE, int);
  170. void DeinitApplication(void);
  171. BOOL InitSimpleCMC (void);
  172. void DeinitSimpleCMC(void);
  173. long FAR PASCAL MainWndProc(HWND, UINT, UINT, LPARAM);
  174. BOOL FAR PASCAL AboutDlgProc(HWND, UINT, UINT, LONG);
  175. BOOL FAR PASCAL InBoxDlgProc(HWND, UINT, UINT, LONG);
  176. BOOL FAR PASCAL ReadMailDlgProc(HWND, UINT, UINT, LONG);
  177. BOOL FAR PASCAL DetailsDlgProc (HWND, UINT, UINT, LONG);
  178. BOOL FAR PASCAL ComposeDlgProc (HWND, UINT, UINT, LONG);
  179. BOOL FAR PASCAL OptionsDlgProc (HWND, UINT, UINT, LONG);
  180. void SecureMenu(HWND hWnd, BOOL fBeforeLogon);
  181.      
  182. void SaveFileAttachments(HWND, CMC_attachment FAR *);
  183. void MakeDisplayNameStr(LPSTR, CMC_enum, ULONG, CMC_recipient FAR *);
  184. ULONG CopyAttachment (CMC_attachment FAR *,CMC_attachment FAR *,CMC_attachment FAR *);
  185. CMC_return_code ResolveFriendlyNames (HWND, LPSTR, CMC_enum, ULONG *, CMC_recipient FAR * *);
  186. CMC_return_code CopyRecipient (CMC_recipient FAR *,CMC_recipient FAR *,CMC_recipient FAR *);
  187. CMC_return_code SaveMsgChanges (HWND,CMC_message far *);
  188. CMC_return_code MakeNewMessage (CMC_message far *, CMC_flags);
  189. CMC_return_code GetNextFile (HWND, ULONG, ULONG *, CMC_attachment FAR * *);
  190. BOOL FNameInList (LPSTR, ULONG, CMC_recipient FAR *);
  191.  
  192. void DrawMsgItem (DRAWITEMSTRUCT *);
  193. void DrawMsgIcon(HDC , HBITMAP , int , int , int , int);
  194.  
  195. LPMSGID MakeMsgNode (CMC_message_summary FAR *);
  196. LPMSGID FindNode (LPMSGID, CMC_message_reference FAR *);
  197. void    InsertMsgNode (LPMSGID, LPMSGID *);
  198. void    DeleteMsgNode (LPMSGID, LPMSGID *);
  199. void    FreeMsgList (LPMSGID);
  200.  
  201. void ConvertDateRec (CMC_time far *, LPSTR);
  202. void MakeMessageBox(HWND, ULONG, UINT, UINT);
  203. void ToggleMenuState(HWND, BOOL);
  204. void LogSendMail(ULONG ulResult);
  205.  
  206. BOOL fCMCInstalled(void);
  207.  
  208. /* CMC functions */
  209.  
  210. extern HINSTANCE    hlibCMC;
  211.  
  212. typedef CMC_return_code (FAR PASCAL *LPFNCMCQUERYCONFIGURATION)
  213.     (CMC_session_id session, CMC_enum item,CMC_buffer reference,CMC_extension FAR *config_extensions);
  214.  
  215. extern LPFNCMCQUERYCONFIGURATION lpfnCMCQueryConfiguration;
  216.  
  217. #define CMCQueryConfiguration           (*lpfnCMCQueryConfiguration)
  218.  
  219.  
  220. typedef CMC_return_code (FAR PASCAL *LPFNCMCLOGON)(
  221.     CMC_string              service,
  222.     CMC_string              user,
  223.     CMC_string              password,
  224.     CMC_enum                character_set,
  225.     CMC_ui_id               ui_id,
  226.     CMC_uint16              caller_cmc_version,
  227.     CMC_flags               logon_flags,
  228.     CMC_session_id FAR      *session,
  229.     CMC_extension FAR       *logon_extensions
  230. );
  231.  
  232. extern LPFNCMCLOGON lpfnCMCLogon;
  233.  
  234. #define CMCLogon            (*lpfnCMCLogon)
  235.  
  236. typedef CMC_return_code (FAR PASCAL *LPFNCMCLOGOFF)(
  237.     CMC_session_id          session,
  238.     CMC_ui_id               ui_id,
  239.     CMC_flags               logoff_flags,
  240.     CMC_extension FAR       *logoff_extensions
  241. );
  242.  
  243. extern LPFNCMCLOGOFF lpfnCMCLogoff;
  244.  
  245. #define CMCLogoff           (*lpfnCMCLogoff)
  246.  
  247.  
  248. typedef CMC_return_code (FAR PASCAL *LPFNCMCFREE)(
  249.     CMC_buffer              memory
  250. );
  251.  
  252. extern LPFNCMCFREE lpfnCMCFree;
  253.  
  254. #define CMCFree     (*lpfnCMCFree)
  255.  
  256. typedef CMC_return_code (FAR PASCAL *LPFNCMCLOOKUP)(
  257.     CMC_session_id          session,
  258.     CMC_recipient FAR       *recipient_in,
  259.     CMC_flags               look_up_flags,
  260.     CMC_ui_id               ui_id,
  261.     CMC_uint32 FAR          *count,
  262.     CMC_recipient FAR * FAR *recipient_out,
  263.     CMC_extension FAR       *look_up_extensions
  264. );
  265.  
  266. extern LPFNCMCLOOKUP lpfnCMCLookUp;
  267.  
  268. #define CMCLookUp (*lpfnCMCLookUp)
  269.  
  270.  
  271. typedef CMC_return_code (FAR PASCAL *LPFNCMCLIST)(
  272.     CMC_session_id          session,
  273.     CMC_string              message_type,
  274.     CMC_flags               list_flags,
  275.     CMC_message_reference   *seed,
  276.     CMC_uint32 FAR          *count,
  277.     CMC_ui_id               ui_id,
  278.     CMC_message_summary FAR * FAR *result,
  279.     CMC_extension FAR       *list_extensions
  280. );
  281.  
  282. extern LPFNCMCLIST lpfnCMCList;
  283.  
  284. #define CMCList  (*lpfnCMCList)
  285.  
  286. typedef CMC_return_code (FAR PASCAL *LPFNCMCSEND)(
  287.     CMC_session_id          session,
  288.     CMC_message FAR         *message,
  289.     CMC_flags               send_flags,
  290.     CMC_ui_id               ui_id,
  291.     CMC_extension FAR       *send_extensions
  292. );
  293.  
  294. extern LPFNCMCSEND lpfnCMCSend;
  295.  
  296. #define CMCSend (*lpfnCMCSend)
  297.  
  298. typedef CMC_return_code (FAR PASCAL *LPFNCMCREAD)(
  299.     CMC_session_id          session,
  300.     CMC_message_reference   *message_reference,
  301.     CMC_flags               read_flags,
  302.     CMC_message FAR * FAR   *message,
  303.     CMC_ui_id               ui_id,
  304.     CMC_extension FAR       *read_extensions
  305. );
  306.  
  307. extern LPFNCMCREAD lpfnCMCRead;
  308.  
  309. #define CMCRead (*lpfnCMCRead)
  310.  
  311. typedef CMC_return_code (FAR PASCAL *LPFNCMCACTON)(
  312.     CMC_session_id          session,
  313.     CMC_message_reference   *message_reference,
  314.     CMC_enum                operation,
  315.     CMC_flags               act_on_flags,
  316.     CMC_ui_id               ui_id,
  317.     CMC_extension FAR       *act_on_extensions
  318. );
  319.  
  320. extern LPFNCMCACTON lpfnCMCActOn;
  321.  
  322. #define CMCActOn (*lpfnCMCActOn)
  323.  
  324.