This topic describes the functions expected by 3ds Max for most plug-in DLL.
Once called for the first time, two main actions are usualy performed:
HINSTANCE hInstance = 0;
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID /*lpvReserved*/)
{
if( fdwReason == DLL_PROCESS_ATTACH )
{
// Hang on to this DLL's instance handle.
hInstance = hinstDLL;
DisableThreadLibraryCalls(hInstance);
}
return(TRUE);
}
__declspec( dllexport ) constTCHAR* LibDescription()
{
// Retrieve astring from the resource string table
static TCHAR buf[256;
if (hInstance)
returnLoadString(hInstance, IDS_LIBDESCRIPTION, buf, sizeof(buf)) ? buf : NULL;
return NULL;
}
__declspec( dllexport ) intLibNumberClasses()
{
return1;
}
__declspec( dllexport ) ClassDesc* LibClassDesc(int i)
{
switch(i)
{
case 0:
return GetSimpleWidgetDesc();
}
return0;
}
__declspec( dllexport ) ULONGLibVersion()
{
returnGet3DSMAXVersion();
}
__declspec( dllexport ) intLibInitialize()
{
// TODO: Perform initialization here.
returnTRUE;
}
__declspec( dllexport ) intLibShutdown()
{
// TODO: Perform uninitialization here.
returnTRUE;
}