1 | #ifndef HELPINSTANCE_H
|
---|
2 | #define HELPINSTANCE_H
|
---|
3 |
|
---|
4 | #include "Utility.h"
|
---|
5 | #include "HelpTables.h"
|
---|
6 | #include "SharedMemory.h"
|
---|
7 |
|
---|
8 | #define MAX_VIEWER_STARTUP_MESSAGES 100
|
---|
9 |
|
---|
10 | #define QWL_HELPINSTANCEPTR 0
|
---|
11 |
|
---|
12 | // offset into window data
|
---|
13 | #define QWL_HELPINSTANCEMAGICNUMBER 4
|
---|
14 | #define HELPINSTANCEMAGICNUMBER 0x7af3b2ea
|
---|
15 |
|
---|
16 | typedef struct
|
---|
17 | {
|
---|
18 | ULONG msg;
|
---|
19 | MPARAM mp1;
|
---|
20 | MPARAM mp2;
|
---|
21 | } TQueuedViewerMessage;
|
---|
22 |
|
---|
23 | // Main help instance structure
|
---|
24 | typedef struct
|
---|
25 | {
|
---|
26 | HWND FHandle; // help window - receives messages from app
|
---|
27 |
|
---|
28 | HAB Fhab; // application anchor block
|
---|
29 |
|
---|
30 | HWND* FApplicationWindows;
|
---|
31 | int FNumApplicationWindows; // current number of windows in use.
|
---|
32 | int FMaxApplicationWindows; // current size of array
|
---|
33 |
|
---|
34 | HWND FActiveWindow;
|
---|
35 |
|
---|
36 | char* FHelpFileNames;
|
---|
37 | char* FHelpWindowTitle;
|
---|
38 |
|
---|
39 | BOOL FViewerStarted;
|
---|
40 | HWND FViewerWindow;
|
---|
41 |
|
---|
42 | TQueuedViewerMessage FViewerStartupMessages[ MAX_VIEWER_STARTUP_MESSAGES ];
|
---|
43 | int FViewerStartupMessagesCount;
|
---|
44 |
|
---|
45 | // main help table: an array of entries,
|
---|
46 | // one for each main app window. Each entry
|
---|
47 | // specifies a help subtable and an "extended help" panel
|
---|
48 | PHELPTABLE pHelpTable;
|
---|
49 | BOOL HelpTableFromResource;
|
---|
50 |
|
---|
51 | TSubAllocatedSharedMemory SharedMemory;
|
---|
52 |
|
---|
53 | } THelpInstance;
|
---|
54 | typedef THelpInstance* TPHelpInstance;
|
---|
55 |
|
---|
56 | //--------------------------------------------------------------------------------
|
---|
57 |
|
---|
58 | // Start the viewer if it's not already running
|
---|
59 | void EnsureViewerRunning( TPHelpInstance pHelpInstance );
|
---|
60 |
|
---|
61 | // Send a message to the viewer. If it hasn't
|
---|
62 | // started yet, then queue the message.
|
---|
63 | void PostViewerMessage( TPHelpInstance pHelpInstance,
|
---|
64 | ULONG msg,
|
---|
65 | MPARAM mp1,
|
---|
66 | MPARAM mp2 );
|
---|
67 |
|
---|
68 | // Post messages to the viewer that have been
|
---|
69 | // queued up waiting for it to complete startup
|
---|
70 | void PostQueuedViewerMessages( TPHelpInstance pHelpInstance );
|
---|
71 |
|
---|
72 | void CloseViewer( TPHelpInstance pHelpInstance );
|
---|
73 |
|
---|
74 | //--------------------------------------------------------------------------------
|
---|
75 |
|
---|
76 | // Add the given window to the list of associated
|
---|
77 | // windows for this help instance
|
---|
78 | void AssociateWindow( TPHelpInstance pHelpInstance,
|
---|
79 | HWND hwnd );
|
---|
80 |
|
---|
81 | void RemoveAssociatedWindow( TPHelpInstance pHelpInstance,
|
---|
82 | HWND hwnd );
|
---|
83 |
|
---|
84 | // Returns true if the given window is associated with
|
---|
85 | // the given help instance
|
---|
86 | BOOL IsWindowAssociated( TPHelpInstance pHelpInstance,
|
---|
87 | HWND hwnd );
|
---|
88 |
|
---|
89 | //--------------------------------------------------------------------------------
|
---|
90 |
|
---|
91 | // return the HelpInstance with the given handle
|
---|
92 | TPHelpInstance GetHelpInstance( HWND hwnd );
|
---|
93 |
|
---|
94 | void ReleaseHelpTable( TPHelpInstance pHelpInstance );
|
---|
95 |
|
---|
96 | TPHelpInstance MakeNewHelpInstance();
|
---|
97 |
|
---|
98 | #endif
|
---|