So, hab mal wieder ein Problem:
Ich hab einen Code geschrieben (versucht), der in einem Verzeichnis dlls sucht, diese dynamisch lädt und in einem Prozeduren-Array speichern soll.
Hier mein Code:
Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
| var result:TSearchRec; counter:integer; dllhandle:THandle; filename:String; begin counter:=0; if FindFirst(ExtractFilePath(application.ExeName)+'module\*.dll',0,result)=0 then begin repeat Inc(counter); SetLength(modules,counter); filename:=(extractfilepath(application.exename)+'\module\'+result.Name); dllhandle:=LoadLibrary(@filename); @modules[counter-1]:=GetProcAddress(dllhandle,'execute'); if @modules[counter-1]<>nil then Label1.Caption:=Label1.Caption+result.Name+' '; until FindNext(result)<>0; FindClose(result); end; end; |
Das Problem ist wohl nicht beim Array zu suchen, denn der lädt die DLL gar nicht, das Handle hat als Wert 0 und dem modules wird nil zugewiesen. Was mach ich falsch, oder wie mach ichs besser *g*
Gruß, Uwe