-
Notifications
You must be signed in to change notification settings - Fork 0
/
General.cpp
163 lines (134 loc) · 3.93 KB
/
General.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// ============================================================================
//
// The following routines are used internally by MMF, and should not need to
// be modified.
//
//
// ============================================================================
#include "Common.h"
HINSTANCE hInstLib;
// ============================================================================
//
// LIBRARY ENTRY & QUIT POINTS
//
// ============================================================================
// -----------------
// Entry points
// -----------------
// Usually you do not need to do any initialization here: you will prefer to
// do them in "Initialize" found in Edittime.cpp
BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
{
switch (dwReason)
{
// DLL is attaching to the address space of the current process.
case DLL_PROCESS_ATTACH:
hInstLib = hDLL; // Store HINSTANCE
break;
// A new thread is being created in the current process.
case DLL_THREAD_ATTACH:
break;
// A thread is exiting cleanly.
case DLL_THREAD_DETACH:
break;
// The calling process is detaching the DLL from its address space.
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
// -----------------
// Initialize
// -----------------
// Where you want to do COLD-START initialization.
// Called when the extension is loaded into memory.
//
extern "C" int WINAPI DLLExport Initialize(mv _far *mV, int quiet)
{
Edif::Init(mV);
// No error
return 0;
}
// -----------------
// Free
// -----------------
// Where you want to kill and initialized data opened in the above routine
// Called just before freeing the DLL.
//
extern "C" int WINAPI DLLExport Free(mv _far *mV)
{
// No error
return 0;
}
// ============================================================================
//
// GENERAL INFO
//
// ============================================================================
// -----------------
// LoadObject
// -----------------
// Routine called for each object when the object is read from the MFA file (edit time)
// or from the CCN or EXE file (run time).
// You can load data here, reserve memory etc...
//
int WINAPI DLLExport LoadObject(mv _far *mV, LPCSTR fileName, LPEDATA edPtr, int reserved)
{
Edif::Init(mV, edPtr);
return 0;
}
// -----------------
// UnloadObject
// -----------------
// The counterpart of the above routine: called just before the object is
// deleted from the frame.
//
void WINAPI DLLExport UnloadObject(mv _far *mV, LPEDATA edPtr, int reserved)
{
}
// --------------------
// UpdateEditStructure
// --------------------
// For you to update your object structure to newer versions
// Called at both edit time and run time
//
HGLOBAL WINAPI DLLExport UpdateEditStructure(mv __far *mV, void __far * OldEdPtr)
{
// We do nothing here
return 0;
}
// --------------------
// UpdateFileNames
// --------------------
// If you store file names in your datazone, they have to be relocated when the
// application is moved to a different directory: this routine does it.
// Called at edit time and run time.
//
// Call lpfnUpdate to update your file pathname (refer to the documentation)
//
void WINAPI DLLExport UpdateFileNames(mv _far *mV, LPSTR appName, LPEDATA edPtr, void (WINAPI * lpfnUpdate)(LPSTR, LPSTR))
{
}
// ---------------------
// EnumElts
// ---------------------
//
// Uncomment this function if you need to store an image in the image bank.
//
// Note: do not forget to enable the function in the .def file
// if you remove the comments below.
//
/*
int WINAPI DLLExport EnumElts (mv __far *mV, LPEDATA edPtr, ENUMELTPROC enumProc, ENUMELTPROC undoProc, LPARAM lp1, LPARAM lp2)
{
int error = 0;
// Replace wImgIdx with the name of the WORD variable you create within the edit structure
// Enum images
if ( (error = enumProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2)) != 0 )
{
// Undo enum images
undoProc (&edPtr->wImgIdx, IMG_TAB, lp1, lp2);
}
return error;
}
*/