-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGeneral.cpp
165 lines (149 loc) · 4.38 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
163
164
165
/* General.cpp
* Contains functions common to both edittime and runtime.
* Functions defined here:
* DllMain
* InitExtension
* FreeExtension
* LoadObject
* UnloadObject
* UpdateEditStrucrure
* UpdateFileNames
* EnumElts
*/
#include "Common.h"
/* hInstLib
* This is the HINSTANCE for your extension's DLL.
* It is set by DllMain and used later for anything
* that requires it, such as some Windows API
* functions and some internal EDIF code. You
* shouldn't change its value, ever.
*/
HINSTANCE hInstLib;
/* DllMain
* This is a required function for Windows DLLs. You
* should not need to edit this function - if you do,
* refer to MSDN for information.
*/
BOOL WINAPI DllMain(HINSTANCE DLL, DWORD Reason, LPVOID)
{
switch (Reason)
{
case DLL_PROCESS_ATTACH: //DLL is attaching to the address space of the current process.
{
hInstLib = DLL; //Store HINSTANCE
break;
}
case DLL_THREAD_ATTACH: //A new thread is being created in the current process.
{
//
break;
}
case DLL_THREAD_DETACH: //A thread is exiting cleanly.
{
//
break;
}
case DLL_PROCESS_DETACH: //The calling process is detaching the DLL from its address space.
{
//
break;
}
}
return TRUE;
}
/* InitExtension
* MMF2 calls this before anything else when it loads your
* extension. This includes during the splash screen, in which
* case "Quiet" is true. This is where you should initialize
* global information for either edittime or runtime. Be aware,
* though, that at edittime, multiple open MFAs with your
* extension will share the same global information. You can
* use mV->mvEditApp to tell apart different MFAs from each
* other. If an error occurs during this function, return
* -1 and MMF2 will not load your extension.
*/
int MMF2Func InitExtension(mv *mV, int Quiet)
{
return Edif::Init(mV);
}
/* FreeExtension
* Called just before MMF2 unloads your extension. You
* should release any memory you allocated above in
* the InitializeExtension function. You should always
* return a value of 0.
*/
int MMF2Func FreeExtension(mv *mV)
{
//
Edif::Free(mV);
return 0;
}
/* LoadObject
* This is called at both edittime and runtime when MMF2
* loads each unique instance of your object. (Each one
* with a different name, not each instance of the same
* one). Not much needs to be done here.
*/
int MMF2Func LoadObject(mv *mV, LPCSTR FileName, SerializedED *SED, int)
{
Edif::Init(mV, SED);
return 0;
}
/* UnloadObject
* new is to delete as LoadObject is to this functon.
* If you initialized stuff above, deinitialize it here.
*/
void MMF2Func UnloadObject(mv *mV, SerializedED *SED, int)
{
//
}
/* UpdateEditStructure (DEPRECATED)
* This is called when MMF2 notices that your
* extension has a newer version number than
* the one in the header of the SerializedED.
* Thankfully, however, we don't need this
* function at all - the EditData class is
* as smart as you programmed it to be and
* it changes the size dynamically rather
* than statically. So, you can safely
* ignore this function all together.
* (It would be a pain to write anyway -
* see the MMF2SDK help for an example)
*/
HGLOBAL MMF2Func UpdateEditStructure(mv *mV, SerializedED *OldSED)
{
return 0;
}
/* UpdateFileNames
* When the application is moved to a new directory,
* MMF2 asks your extension to ensure that its file
* paths are moving with it. Just call Update for
* each file path - you will need to create buffers
* of size MAX_PATH if you use C++ strings for
* the paths.
*/
void MMF2Func UpdateFileNames(mv *mV, LPSTR appName, SerializedED *SED, void (WINAPI *Update)(LPSTR, LPSTR))
{
//
}
/* EnumElts
* That whacky function that MMF2 uses to enumerate all the
* animation frames associated with your object, because MMF2
* is nice enough to deal with them for you so you can't-er,
* don't have to. Refer to the MMF2SDK Help file for
* information on how not to misuse this function.
* You must also uncomment the entry in the Ext.def
* file if you uncomment this function.
*/
/*int MMF2Func EnumElts (mv *mV, SerializedED *SED, 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;
}*/