dll und Programm abbruch



  • Hallo.

    Ich habe eine Komponente welche eine xyz.dll nutzt.
    Wenn die dll nicht vorhanden ist, dann stürzt das Prgramm ab,
    bzw es meldet einen "Programmfehler" und sagt das es ins Ereignisprotokoll schreibt.

    Um das abzufangen habe ich

    WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
    {
    	try
    	{
    
    HINSTANCE instance = LoadLibrary("xyz.dll");
    if (instance==NULL)
    {
        ShowMessage("xyz.dll missing");
        return 0;
    }
    

    Das funktioniert aber nicht. Der Abbruch kommt zuerst.
    Wenn ich die DLL in xyz.dll umbenenne funktioniert alles.
    Mach ich was falsch?



  • Ich mach das so (ähnlich)

    HINSTANCE hModule;
      hModule=LoadLibrary("DPSDLL.DLL");
      if (hModule!=NULL)
      { FP=(TDPSExecute*)GetProcAddress(hModule,"DPSExecute");
        if FP!=NULL)
        {
          FP();
        }
        FreeLibrary(hModule);
      }
    

    PS:DPSExecute ist die exportierte Funktion.


Anmelden zum Antworten