Getting path of loaded VST plugin DLL


#1

To be able to make File::getSpecialLocation(File::currentExecutableFile) return the path to the loaded DLL instead of the host executable, I added this in juce_VST_wrapper.cpp:


    BOOL WINAPI DllMain(
        HINSTANCE hinstDLL,  // handle to DLL module
        DWORD fdwReason,     // reason for calling function
        LPVOID lpReserved )  // reserved
    {
        switch( fdwReason ) 
        {
        case DLL_PROCESS_ATTACH:
            Process::setCurrentModuleInstanceHandle(hinstDLL);
            break;
        default:
            break;
        }
        return TRUE;
    }

I don't know if it can be used elsewhere for JUCE DLL builds ?


#2

Uh! Saw the documentation. I'm doing it my own plugin init code now.