home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / os2sdk / os2sdk12 / spy / spy.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-20  |  7.7 KB  |  287 lines

  1. /****** Resource IDs *****/
  2.  
  3. #define IDR_SPY    1
  4. #define IDD_DLGSPY  0x001
  5. #define MessagesDlg 0x002
  6. #define OutputsDlg  0x003
  7. #define WindowsDlg  0x004
  8. #define SaveListDlg 0x005
  9. #define AboutDlg    0x006
  10. #define ListNearDlg 0x007
  11. #define MsgQueueDlg 0x008
  12.  
  13. /****** Menu command IDs *****/
  14. /* (by convention, hi byte is menu index, lo byte is dispatch table index) */
  15.  
  16. /* Spy Menu */
  17. #define CMD_ACTIVE      0x0000
  18. #define CMD_EXIT        0x0001
  19. #define CMD_ABOUT       0x0002
  20. #define CMD_CLRWIN      0x0003
  21. #define CMD_SAVEWIN     0x0004
  22. #define CMD_SAVEOPT     0x0005
  23. #define CMD_LISTNEAR    0x0006
  24.  
  25. /* Window Menu */
  26. #define CMD_WINDOWS     0x0100
  27. #define CMD_QUEUES      0x0101
  28. #define CMD_WNMSSEL     0x0102
  29. #define CMD_WNMSDSL     0x0103
  30. #define CMD_ALLWNDWS    0x0104
  31. #define CMD_ALLFRAMES   0x0105
  32. #define CMD_WNDPWIN     0x0106
  33. #define CMD_WNDPALL     0x0107
  34.  
  35. /* Message Menu */
  36. #define CMD_MESSAGES    0x0200
  37. #define CMD_MGDABLE     0x0201
  38. #define CMD_MGEABLE     0x0202
  39. #define CMD_ALPHASORT   0x0203
  40.  
  41. /* Hooks Menu */
  42. #define CMD_INPUTHOOK   0x0300
  43. #define CMD_SENDMSGHOOK 0x0301
  44. #define CMD_SENDEXTEND  0x0302
  45. #define CMD_SENDSTACK   0x0303
  46.  
  47. /* Outputs Menu */
  48. #define CMD_OUTSCREEN   0x0400
  49. #define CMD_OUTTERM     0x0401
  50. #define CMD_OUTFILE     0x0402
  51. #define CMD_OUTPUTS     0x0403
  52.  
  53.  
  54. #define IDD_DLGOPTIONS  0x010
  55. #define IDD_DLGWINDOWS  0x020
  56. #define IDD_DLGSAVELIST 0x030
  57. #define IDD_DLGLISTNEAR 0x040
  58.  
  59. /* From the Main Dialog */
  60. #define DID_SPYLIST     0x0100
  61.  
  62.  
  63. /* From the Options Dialog */
  64. #define DID_OMSGLIST    0x0100
  65. #define DID_MALL        0x0101
  66. #define DID_MNONE       0x0102
  67. #define DID_MCON        0x0103
  68. #define DID_MCOFF       0x0104
  69. #define DID_MMON        0x0105
  70. #define DID_MMOFF       0x0106
  71. #define DID_MFON        0x0107
  72. #define DID_MFOFF       0x0108
  73. #define DID_MSGEDIT     0x0109
  74.  
  75. #define DID_OINPUT      0x0120
  76. #define DID_OSENDMSG    0x0121
  77. #define DID_OTHERMSGS   0x0122
  78.  
  79. #define DID_WINDOW      0x0110
  80. #define DID_DEBUG       0x0111
  81. #define DID_FILE        0x0112
  82. #define DID_WINDOWLINES 0x0113
  83. #define DID_FILENAME    0x0114
  84.  
  85. /* From the Windows Dialog */
  86. #define DID_WINDOWLIST  0x0200
  87. #define DID_WHANDLE     0x0201
  88. #define DID_WPARENT     0x0202
  89. #define DID_WCHILD      0x0203
  90. #define DID_WOWNER      0x0204
  91. #define DID_WRECT       0x0205
  92. #define DID_WID         0x0207
  93. #define DID_WSELALL     0x0208
  94. #define DID_WUNSELALL   0x0209
  95. #define DID_WSELMOUSE   0x020a
  96. #define DID_WSTYLE      0x020b
  97. #define DID_WCSTYLE     0x020c
  98. #define DID_WPFNWP      0x020d
  99. #define DID_WHMQ        0x020e
  100. #define DID_WCLASS      0x020f
  101. #define DID_WOLINE1     0x0210
  102. #define DID_WOLINE2     0x0211
  103. #define DID_WOLINE3     0x0212
  104. #define DID_WOLINE4     0x0213
  105. #define DID_WTEXT       0x0214
  106. #define DID_WPID        0x0215
  107. #define DID_WTID        0x0216
  108.  
  109. /* From the save file dialog */
  110. #define DID_APPEND              0x0300
  111.  
  112. /* From the symbol dialog */
  113. #define DID_SYMLIST             0x0400
  114. #define DID_ADDRLABEL           0x0401
  115. #define DID_ADDR                0x0402
  116. #define DID_PIDLABEL            0x0403
  117. #define DID_PID                 0x0404
  118.  
  119. /*
  120.  * Define data structures
  121.  */
  122. typedef struct _SPYOPT { /* Spy Options */
  123.     /* Now define the output options */
  124.     /* In options dialog */
  125.     BOOL        fWindow;
  126.     BOOL        fFile;
  127.     SHORT       cWindowLines;
  128.     HFILE       hfileSpy;               /* if all lines go to file */
  129.  
  130.     /* SendMsg Hook Output options */
  131.     USHORT      bHooks;                 /* Which hooks are enabled */
  132.     BOOL        fSendExtend;            /* Should extended data be displayed */
  133.     BOOL        fSendStack;             /* Should call stack be displayed */
  134.  
  135.     /* In Save file dialog */
  136.     BOOL        fAppend;
  137.  
  138.     /* In Message Dialog */
  139.     BOOL        fDispOtherMsgs;         /* Undefined messages displayed? */
  140.     BOOL        fAlphaSortMsgList;      /* Should the message list be sorted */
  141.  
  142. } SPYOPT;       /* spyoptions */
  143.  
  144. typedef struct _spystr {
  145.  
  146.     /* Define file names at end, will define as seperate strings in os2.ini */
  147.     CHAR        szFileName[100];
  148.     char        szSaveFileName[100];
  149. } SPYSTR;       /* Strings are seperated from options */
  150.  
  151. typedef struct _IDTONAME {
  152.     USHORT  id;             /* id of window */
  153.     char    *szIdName;      /* String with text of ID */
  154. } IDTONAME;
  155.  
  156. /*
  157.  * Define the system defined limits
  158.  */
  159. #define CBSTACK     4096
  160. /* This is a real hack, estimate size of WND Structure */
  161. #define SIZEOFWND   34
  162. #define MAXMSGBYTES 100
  163.  
  164. /*
  165.  * Define Message output information
  166.  */
  167.  
  168. #define MSGI_ENABLED    0x0001
  169. #define MSGI_MOUSE      0x0002  /* Mouse type messages */
  170. #define MSGI_KEY        0x0004  /* Key type messages */
  171. #define MSGI_FREQ       0x0010  /* Frequent messages generaly ignored */
  172.  
  173.  
  174. typedef struct _MSGI {
  175.  
  176.     USHORT  msg;
  177.     char    *szMsg;
  178.     USHORT  wOptions;
  179.     UCHAR   bMPTypes;
  180.     SHORT   iListBox;
  181. } MSGI;
  182.  
  183. /*
  184.  * Now define all of the global strutures that are exported from
  185.  * the initializition file
  186.  */
  187. extern SPYOPT       spyopt;
  188. extern SPYSTR       spystr;
  189. extern MSGI         rgmsgi[];
  190. extern SHORT        cmsgi;          /* Count of message info items */
  191. extern IDTONAME     rgidtoname[];
  192. extern SHORT        cToName;        /* Count of items in cToName */
  193.  
  194.  
  195. /*
  196.  * External definitions used between source files
  197.  */
  198.  
  199. extern HAB         hab;
  200. extern HMQ         hmqSpy;
  201. extern HWND        hwndSpy;
  202. extern HWND        hwndSpyFrame;
  203. extern HWND        hwndSpyList;
  204. extern HWND        hwndWindowLB;
  205. extern HWND        hwndMessageLB;
  206. extern HHEAP       hHeap;
  207. extern SHORT       cxBorder;
  208. extern SHORT       cyBorder;
  209.  
  210. extern HPOINTER    hptrArrow;
  211. extern HPOINTER    hptrSelWin;
  212.  
  213. extern USHORT      iCurItemFocus;              /* Index to item that has the focus */
  214. extern BOOL        fSpyActive;                 /* Any non-zero is true */
  215. extern BOOL        fTrackingListBox;           /* Tracking windows active ? */
  216. extern BOOL        fAllFrames;                 /* Are we processing all frames ? */
  217. extern BOOL        fAllWindows;                /* Are we processing all windows ? */
  218.  
  219. extern HWND        hwndWinDlgDisp;             /* hwnds info in Window Dialog */
  220.  
  221.  
  222.  
  223. /*
  224.  * simple structure for sorting Hwnds in dumping
  225.  */
  226. typedef struct _spwd {
  227.     HWND    hwnd;
  228.     SHORT   index;
  229. } SPWD;
  230.  
  231. #define     MAXSPYDUMP  1000         /* Max of a thousand windows */
  232. extern SHORT wDumpCount;             /* Count of which window is being dumped */
  233. extern SPWD  *pspwd;
  234.  
  235. /*
  236.  * External function definitions
  237.  */
  238. /*
  239.  * Spy.c
  240.  */
  241. extern MRESULT EXPENTRY SpyWndProc();
  242. extern USHORT  UConvertStringToNum(char *);
  243. extern void    OutputString(char [], SHORT);
  244. extern MSGI    *PmsgiFromMsg(USHORT);
  245.  
  246. /*
  247.  * Message.c
  248.  */
  249. extern MRESULT EXPENTRY SpyMsgDlgProc();
  250. extern void    UpdateHooksMsgTable(void);
  251. extern void    EnableOrDisableMsg(BOOL);
  252.  
  253. /*
  254.  * Options.c
  255.  */
  256. extern MRESULT EXPENTRY SpyOutputsDlgProc();
  257. extern MRESULT EXPENTRY SpySaveListDlgProc();
  258. extern MRESULT EXPENTRY AboutWndProc();
  259.  
  260. /*
  261.  * Queue.c
  262.  */
  263. extern MRESULT EXPENTRY SpyQueuesDlgProc();
  264. extern void    EnableOrDisableMsg(BOOL);
  265. extern void    UpdateHooksMsgTable(void);
  266.  
  267. /*
  268.  * Symbol.c
  269.  */
  270. extern MRESULT EXPENTRY ListNearDlgProc();
  271.  
  272. /*
  273.  * Window.c
  274.  */
  275. extern MRESULT EXPENTRY SpyWindowsDlgProc();
  276. extern void    DumpOneWindowInfo(void);
  277. extern SHORT   DumpAllWindowsInfo(HWND, SHORT);
  278. extern void    DumpWindowIndex(SHORT);
  279. extern void    SelOrDeselWithMouse(BOOL);
  280. extern HWND    HwndSelWinWithMouse(HWND, void (*)(HWND, HWND));
  281.  
  282. /*
  283.  * SpyUtil.asm
  284.  */
  285. extern  BOOL FValidPointer (CHAR FAR *pVoid, SHORT cbStruct);
  286. extern  BOOL FGuessValidPointer (CHAR FAR *pVoid, SHORT cbStruct);
  287.