home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / sdktools / winnt / ddespy / ddespy.h < prev    next >
C/C++ Source or Header  |  1997-10-05  |  13KB  |  344 lines

  1.  
  2. /******************************************************************************\
  3. *       This is a part of the Microsoft Source Code Samples. 
  4. *       Copyright (C) 1993-1997 Microsoft Corporation.
  5. *       All rights reserved. 
  6. *       This source code is only intended as a supplement to 
  7. *       Microsoft Development Tools and/or WinHelp documentation.
  8. *       See these sources for detailed information regarding the 
  9. *       Microsoft samples programs.
  10. \******************************************************************************/
  11.  
  12. /*
  13.  * DDESPY.H
  14.  *
  15.  * Header file for DDESPY Symbols
  16.  */
  17. #define DDEMLDB
  18.  
  19. #include <ddeml.h>
  20. #include "dialog.h"
  21.  
  22. #define MH_INTCREATE                5
  23. #define MH_INTKEEP                  6
  24. #define MH_INTDELETE                7
  25.  
  26. #define IDD_MSGFILTERS              300
  27. #define IDRB_WM_DDE_INITIATE        305
  28. #define IDRB_WM_DDE_TERMINATE       306
  29. #define IDRB_WM_DDE_ADVISE          307
  30. #define IDRB_WM_DDE_UNADVISE        308
  31. #define IDRB_WM_DDE_ACK             309
  32. #define IDRB_WM_DDE_DATA            310
  33. #define IDRB_WM_DDE_REQUEST         311
  34. #define IDRB_WM_DDE_POKE            312
  35. #define IDRB_WM_DDE_EXECUTE         313
  36. #define IDRB_XTYP_ERROR             314
  37. #define IDRB_XTYP_ADVDATA           315
  38. #define IDRB_XTYP_ADVREQ            316
  39. #define IDRB_XTYP_ADVSTART          317
  40. #define IDRB_XTYP_ADVSTOP           318
  41. #define IDRB_XTYP_EXECUTE           319
  42. #define IDRB_XTYP_CONNECT           320
  43. #define IDRB_XTYP_CONNECT_CONFIRM   321
  44. #define IDRB_XACT_COMPLETE          322
  45. #define IDRB_XTYP_POKE              323
  46. #define IDRB_XTYP_REGISTER          324
  47. #define IDRB_XTYP_REQUEST           325
  48. #define IDRB_XTYP_DISCONNECT        326
  49. #define IDRB_XTYP_UNREGISTER        327
  50. #define IDRB_XTYP_WILDCONNECT       328
  51. #define IDRB_TERSE                  329
  52.  
  53. #define IDR_ACCEL                   30
  54. #define IDR_MENU                    31
  55. #define IDD_VALUEENTRY              50
  56. #define IDD_ABOUTBOX                51
  57. #define IDD_OPEN                    52
  58. #define IDM_OUTPUT_FIRST            100
  59. #define IDM_OUTPUT_FILE             100
  60. #define IDM_OUTPUT_DEBUG            101
  61. #define IDM_OUTPUT_SCREEN           102
  62. #define IDM_CLEARSCREEN             103
  63. #define IDM_MARK                    104
  64. #define IDM_FILTER_FIRST            200
  65. #define IDM_FILTER_HSZINFO          200
  66. #define IDM_FILTER_INIT_TERM        201
  67. #define IDM_FILTER_DDEMSGS          202
  68. #define IDM_FILTER_CALLBACKS        203
  69. #define IDM_FILTER_ERRORS           204
  70. #define IDM_FILTER_DIALOG           205
  71. #define IDM_TRACK_FIRST             301
  72. #define IDM_TRACK_HSZS              301
  73. #define IDM_TRACK_CONVS             302
  74. #define IDM_TRACK_LINKS             303
  75. #define IDM_TRACK_SVRS              304
  76. #define IDM_TRACK_LAST              304
  77. #define IDM_ABOUT                   401
  78. #define IDM_TEST                    402
  79.  
  80. #define IDM_MSGF_0                  500
  81. #define IDM_MSGF_1                  501
  82. #define IDM_MSGF_2                  502
  83. #define IDM_MSGF_3                  503
  84. #define IDM_MSGF_4                  504
  85. #define IDM_MSGF_5                  505
  86. #define IDM_MSGF_6                  506
  87. #define IDM_MSGF_7                  507
  88. #define IDM_MSGF_8                  508
  89.  
  90. #define IDM_CBF_0                   600
  91. #define IDM_CBF_1                   601
  92. #define IDM_CBF_2                   602
  93. #define IDM_CBF_3                   603
  94. #define IDM_CBF_4                   604
  95. #define IDM_CBF_5                   605
  96. #define IDM_CBF_6                   606
  97. #define IDM_CBF_7                   607
  98. #define IDM_CBF_8                   608
  99. #define IDM_CBF_9                   609
  100. #define IDM_CBF_10                  610
  101. #define IDM_CBF_11                  611
  102. #define IDM_CBF_12                  612
  103. #define IDM_CBF_13                  613
  104. #define IDM_CBF_14                  614
  105.  
  106. #define IDS_TITLE                   0
  107. #define IDS_DEFAULT_OUTPUT_FNAME    1
  108. #define IDS_INIFNAME                2
  109. #define IDS_CLASS                   3
  110. #define IDS_HUH                     4
  111. #define IDS_ZERO                    5
  112. #define IDS_CRLF                    6
  113. #define IDS_TRACKTITLE_1            7
  114. #define IDS_TRACKTITLE_2            8
  115. #define IDS_TRACKTITLE_3            9
  116. #define IDS_TRACKTITLE_4            10
  117. #define IDS_TRACKHEADING_1          11
  118. #define IDS_TRACKHEADING_2          12
  119. #define IDS_TRACKHEADING_3          13
  120. #define IDS_TRACKHEADING_4          14
  121. #define IDS_QCLOSEFILE_TEXT         15
  122. #define IDS_QCLOSEFILE_CAPTION      16
  123. #define IDS_ACTION_CLEANEDUP        17
  124. #define IDS_ACTION_DESTROYED        18
  125. #define IDS_ACTION_INCREMENTED      19
  126. #define IDS_ACTION_CREATED          20
  127. #define IDS_SENT                    21
  128. #define IDS_POSTED                  22
  129. #define IDS_INPUT_DATA              23
  130. #define IDS_TABDDD                  24
  131. #define IDS_OUTPUT_DATA             25
  132. #define IDS_WARM                    26
  133. #define IDS_HOT                     27
  134. #define IDS_UNKNOWN_CALLBACK        28
  135. #define IDS_APPIS                   29
  136. #define IDS_TOPICIS                 30
  137. #define IDS_ITEMIS                  31
  138. #define IDS_OR                      32
  139. #define IDS_FACKREQ                 33
  140. #define IDS_DEFERUPD                34
  141. #define IDS_FACK                    35
  142. #define IDS_FBUSY                   36
  143. #define IDS_FRELEASE                37
  144. #define IDS_FREQUESTED              38
  145. #define IDS_ERRST0                  39
  146. #define IDS_ERRST1                  40
  147. #define IDS_ERRST2                  41
  148. #define IDS_ERRST3                  42
  149. #define IDS_ERRST4                  43
  150. #define IDS_ERRST5                  44
  151. #define IDS_ERRST6                  45
  152. #define IDS_ERRST7                  46
  153. #define IDS_ERRST8                  47
  154. #define IDS_ERRST9                  48
  155. #define IDS_ERRST10                 49
  156. #define IDS_ERRST11                 50
  157. #define IDS_ERRST12                 51
  158. #define IDS_ERRST13                 52
  159. #define IDS_ERRST14                 53
  160. #define IDS_ERRST15                 54
  161. #define IDS_ERRST16                 55
  162. #define IDS_ERRST17                 56
  163. #define IDS_MSG0                    57
  164. #define IDS_MSG1                    58
  165. #define IDS_MSG2                    59
  166. #define IDS_MSG3                    60
  167. #define IDS_MSG4                    61
  168. #define IDS_MSG5                    62
  169. #define IDS_MSG6                    63
  170. #define IDS_MSG7                    64
  171. #define IDS_MSG8                    65
  172. #define IDS_TYPE0                   66
  173. #define IDS_TYPE1                   67
  174. #define IDS_TYPE2                   68
  175. #define IDS_TYPE3                   69
  176. #define IDS_TYPE4                   70
  177. #define IDS_TYPE5                   71
  178. #define IDS_TYPE6                   72
  179. #define IDS_TYPE7                   73
  180. #define IDS_TYPE8                   74
  181. #define IDS_TYPE9                   75
  182. #define IDS_TYPE10                  76
  183. #define IDS_TYPE11                  77
  184. #define IDS_TYPE12                  78
  185. #define IDS_TYPE13                  79
  186. #define IDS_TYPE14                  80
  187. #define IDS_TYPE15                  81
  188. #define IDS_INVALID_FNAME           82
  189. #define IDS_PROF_OUT_FILE           83
  190. #define IDS_PROF_OUT_DEBUG          84
  191. #define IDS_PROF_OUT_SCREEN         85
  192. #define IDS_PROF_MONITOR_STRINGHANDLES   86
  193. #define IDS_PROF_MONITOR_INITIATES       87
  194. #define IDS_PROF_MONITOR_DDE_MESSAGES    88
  195. #define IDS_PROF_MONITOR_CALLBACKS       89
  196. #define IDS_PROF_MONITOR_ERRORS          90
  197. #define IDS_PROF_TRACK_STRINGHANDLES     91
  198. #define IDS_PROF_TRACK_LINKS             92
  199. #define IDS_PROF_TRACK_CONVERSATIONS     93
  200. #define IDS_PROF_TRACK_SERVICES          94
  201. #define IDS_PROF_TERSE              95
  202. #define IDS_YES                     96
  203. #define IDS_NO                      97
  204. #define IDS_MARKDLGTITLE            98
  205. #define IDS_SEPERATOR               99
  206. #define IDS_MARKTEXT                100
  207. #define IDS_LISTCLASS               101
  208. #define IDS_LBOX                    102
  209. #define IDS_WILD                    103
  210. #define IDS_STRINGCLASS             104
  211. #define IDS_FMT_CB1                 105
  212. #define IDS_FMT_CB2                 106
  213. #define IDS_FMT_CTXT1               107
  214. #define IDS_FMT_DATAIS1             108
  215. #define IDS_FMT_ER1                 109
  216. #define IDS_FMT_EXEC1               110
  217. #define IDS_FMT_MSG1                111
  218. #define IDS_FMT_MSG2                112
  219. #define IDS_FMT_STATUSIS            113
  220. #define IDS_FMT_TRS_CB1             114
  221. #define IDS_FMT_TRS_CB2             115
  222. #define IDS_FMT_TRS_CTXT1           116
  223. #define IDS_FMT_TRS_DATAIS1         117
  224. #define IDS_FMT_TRS_ER1             118
  225. #define IDS_FMT_TRS_EXEC1           119
  226. #define IDS_FMT_TRS_MSG1            120
  227. #define IDS_FMT_TRS_MSG2            121
  228. #define IDS_FMT_TRS_STATUSIS        122
  229. #define IDS_FMT_SH_MSG1             123
  230. #define IDS_FMT_BADATOM            124
  231. #define IDS_LAST                    124
  232. // IDS_LAST marks the last string ID that is used.
  233.  
  234. #define T_ATOM                      0x0001
  235. #define T_OPTIONHANDLE              0x0002
  236. #define T_FORMAT                    0x0004
  237. #define T_STATUS                    0x0008
  238. #define T_DATAHANDLE                0x0010
  239. #define T_STRINGHANDLE              0x0020
  240. #define T_VALUE                     0x0040
  241. #define T_APP                       0x0080
  242. #define T_TOPIC                     0x0100
  243. #define T_ITEM                      0x0200
  244. #define T_OR                        0x0400
  245.  
  246.  
  247. #define IO_FILE                     0
  248. #define IO_DEBUG                    1
  249. #define IO_SCREEN                   2
  250. #define IO_COUNT                    3
  251.  
  252. #define IF_HSZ                      0
  253. #define IF_SEND                     1
  254. #define IF_POST                     2
  255. #define IF_CB                       3
  256. #define IF_ERR                      4
  257.  
  258. #define IF_COUNT                    5
  259.  
  260. #define IT_HSZS                     0
  261. #define IT_CONVS                    1
  262. #define IT_LINKS                    2
  263. #define IT_SVRS                     3
  264.  
  265. #define IT_COUNT                    4
  266.  
  267. #define MAX_FNAME                   MAX_PATH
  268. #define BUFFER_SIZE                 400
  269. #define MAX_MARK                    32
  270. #define MAX_DISPDATA                48      // max bytes of non-text data to dump
  271.  
  272. #define CLINES                      100
  273. #define CCHARS                      200
  274.  
  275. extern HINSTANCE hInst;
  276.  
  277. /* macro definitions */
  278. #define MyAlloc(cb)         (LPTSTR)LocalAlloc(LPTR, (cb))
  279. #define MyFree(p)           (LocalUnlock((HANDLE)(p)), LocalFree((HANDLE)(p)))
  280. #define RefString(id)       (LPTSTR)apszResources[id]
  281. #define Type2String(type)   apszResources[IDS_TYPE0 + ((type & XTYP_MASK) >> XTYP_SHIFT)]
  282. #define MPRT(b)             (isprint(b) ? (b) : '.')
  283.  
  284. /* prototype definitions */
  285. BOOL InitApplication(HANDLE);
  286. BOOL InitInstance(HANDLE, INT);
  287. VOID CloseApp(VOID);
  288. LONG CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
  289. BOOL CALLBACK About(HWND, UINT, WPARAM, LPARAM);
  290. BOOL SetFilters(VOID);
  291. BOOL CALLBACK OpenDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  292. BOOL CALLBACK FilterDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  293. LPTSTR DisectMsgLP(UINT msg, MONMSGSTRUCT *pmms, LPTSTR pszBuf);
  294. LPTSTR DisectWord(UINT type, UINT data, DDEML_MSG_HOOK_DATA *pdmhd, LPTSTR pstr);
  295. LPTSTR pdf(UINT fmt);
  296. LPTSTR DumpFormat(UINT fmt, LPTSTR pstr);
  297. LPTSTR DdeMsg2String(UINT msg);
  298. LPTSTR Error2String(UINT error);
  299. LPTSTR DumpData(LPBYTE pData, UINT cb, TCHAR *szBuf, UINT fmt);
  300. LPTSTR GetHszName(HSZ hsz);
  301. VOID OutputString(LPTSTR pstr);
  302. VOID GetProfile(VOID);
  303. VOID SaveProfile(VOID);
  304. BOOL GetProfileBoolean(LPTSTR pszKey, BOOL fDefault);
  305. VOID SetProfileBoolean(LPTSTR pszKey, BOOL fSet);
  306. HDDEDATA CALLBACK DdeCallback(UINT wType, UINT wFmt, HCONV hConv, HSZ hsz1,
  307.       HSZ hsz2, HDDEDATA hData, UINT lData1, UINT lData2);
  308. INT FAR DoDialog(LPTSTR lpTemplateName, DLGPROC lpDlgProc, UINT param,
  309.       BOOL fRememberFocus, HWND hwndParent, HANDLE hInst);
  310. BOOL  CALLBACK MarkDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  311.  
  312. /* testsubs.c prototypes */
  313.  
  314. /* StringWindow structure */
  315. typedef struct {
  316.     INT cchLine;
  317.     INT cLine;
  318.     INT offBuffer;
  319.     INT offBufferMax;
  320.     INT offBottomLine;
  321.     INT offOutput;
  322.     INT cBottomLine;
  323.     INT cLeftChar;
  324. } STRWND;
  325.  
  326.  
  327. BOOL InitTestSubs(VOID);
  328. VOID CloseTestSubs(HANDLE hInst);
  329. VOID NextLine(STRWND *psw);
  330. VOID DrawString(HWND hwnd, TCHAR *sz);
  331. VOID ClearScreen(STRWND *psw);
  332. LONG CALLBACK StrWndProc(HWND hwnd, UINT msg, WPARAM wParam, UINT lParam);
  333. VOID scroll(HWND hwnd, UINT msg, UINT sliderpos, UINT style);
  334. BOOL StrWndCreate(HWND hwnd, INT cchLine, INT cLine);
  335. VOID PaintStrWnd(HWND hwnd, LPPAINTSTRUCT pps);
  336.  
  337. #define strchr      My_mbschr
  338. #ifdef stricmp
  339. #undef stricmp
  340. #endif
  341. #define stricmp     lstrcmpi
  342. LPTSTR _CRTAPI1 My_mbschr(LPTSTR, unsigned short);
  343.  
  344.