Required DLL Functions

This topic describes the functions expected by 3ds Max for most plug-in DLL.

Example:

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 ) const TCHAR* LibDescription()
{
   // Retrieve astring from the resource string table
   static TCHAR buf[256];
   if (hInstance)
      return LoadString(hInstance, IDS_LIBDESCRIPTION, buf, sizeof(buf)) ? buf : NULL;
   return NULL;   
}

__declspec( dllexport ) int LibNumberClasses()
{
  return 1;
}

__declspec( dllexport ) ClassDesc* LibClassDesc(int i)
{
  switch(i)
  {
    case 0:
       return GetSimpleWidgetDesc();
  }

  return 0;
}

__declspec( dllexport ) ULONG LibVersion()
{
  return Get3DSMAXVersion();
}

__declspec( dllexport ) int LibInitialize()
{
  // TODO: Perform initialization here.
  return TRUE;
}

__declspec( dllexport ) int LibShutdown()
{
  // TODO: Perform uninitialization here.
  return TRUE;
}