source: trunk/MFCtooling/userlog/userlog.h @ 46

Last change on this file since 46 was 32, checked in by sherbold, 14 years ago
File size: 1.9 KB
RevLine 
[32]1#ifdef USERLOG_EXPORTS
2#define USERLOG_API __declspec(dllexport)
3#else
4#define USERLOG_API __declspec(dllimport)
5#endif
6
7#include <iostream>
8#include <fstream>
9
10
11
12//#define __USING_MTRACE__
13#define __USING_COSTUMLOG__
14#define __INCLUDEHOOKINFO__
15//#define __TIMING__
16#define __ENCODE_BASE64__
17
18#define LOGPREFIX " UL: "
19#define LOGPREFIXCONT " ULC: "
20#define LOGPREFIXWSTRING L" UL: "
21
22#define NUMHOOKS 2
23
24#define CALLWNDHOOKID 0
25#define GETMSGHOOKID 1
26
27#ifdef __USING_COSTUMLOG__
28#define LOGFILE "usagelog.txt"
29#endif
30
31typedef struct _HOOKDATA {
32        int nType;
33        HOOKPROC hkproc;
34        HHOOK hookhandle;
35        bool active;
36} HOOKDATA;
37
38HOOKDATA myhookdata[NUMHOOKS];
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44/**
45 * API function that starts the logging of messages.
46 * All required hooks and logging mechanisms are initialized.
47 */
48USERLOG_API void __cdecl InitUsagelog();
49
50/**
51 * API function that stopts the logging of messages.
52 * All existing hooks are released and if required, logging mechnisms are stopped.
53 */
54USERLOG_API void __cdecl ReleaseUsagelog();
55
56#ifdef __cplusplus
57} // extern "C"
58#endif
59
60
61void InitHookdata();
62
63void InitHooks();
64
65void ReleaseHooks();
66
67
68LRESULT CALLBACK CallWndProc(int nCode, WPARAM wParam, LPARAM lParam);
69
70LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam);
71
72void HookProc(int nFrom, int nCode, PMSG msg);
73
74/**
75 * Compares two messages parameter-wise.
76 * TODO: Check if this works better, if MSG.time and MSG.pt are ignored in the comparison, as they are missing in CWPSTRUCT.
77 * TODO: In case of CWPSTRICT both values are per default -1.
78 */
79bool MessageEquals(const MSG & msg1, const MSG & msg2);
80
81void WriteLogentryWString(PMSG msg, int nFrom);
82
83int replaceWithXmlEntitiesWString(const wchar_t * source, wchar_t ** target, size_t sourceLength);
84
85#ifdef __USING_COSTUMLOG__
86void InitLogfile();
87
88void CloseLogfile();
89#endif
Note: See TracBrowser for help on using the repository browser.