to jest w formie w var
/// pluginy
DLL:array of THandle; // uchwyt biblioteki
iledll:integer;
Initialize:array of procedure(form:tglowne);stdcall;
sendmsg:array of function(msg:string;nrGG:integer;Form: TForm;Hgg:thgg):string;stdcall;
Procedura ladujaca pluginy
procedure Tglowne.ladujepluginy(Init:string);
var
F:TextFile;
text:string;
begin
setlength(Dll,0);
setlength(Initialize,0);
setlength(sendmsg,0);
//// tworzenie form z dll
AssignFile(F,'./dll/pluginy.txt');
reset(F);
while not eof(F) do
begin
readln(F,text);
if text<>'' then
begin
setlength(Initialize,Length(DLL)+1);
setlength(sendmsg,Length(DLL)+1);
setlength(Dll,Length(DLL)+1);
DLL[Length(DLL)-1] := LoadLibrary(PChar('dll/'+text)); // laduj biblioteke
if init='tak' then
begin
@Initialize[Length(DLL)-1] := GetProcAddress(DLL[Length(DLL)-1], 'Initialize');
if @Initialize[Length(DLL)-1] = nil then raise Exception.Create(text+'// Initialize // Bład - nie mogę znaleźć proceudry w bibliotece!');
Initialize[Length(DLL)-1](glowne);
end;
@sendmsg[Length(DLL)-1] := GetProcAddress(DLL[Length(DLL)-1], 'SendMsg');
if @sendmsg[Length(DLL)-1] = nil then raise Exception.Create(text+'// SendMsg // Bład - nie mogę znaleźć proceudry w bibliotece!');
end;
end;
closefile(F);
end;
i potem jak ktos wysle wiadomosc to robie to
ladujepluginy('nie');
smsg:='tak';
try
for i:=0 to length(sendmsg)-1 do
smsg:=sendmsg[i](MessageContent,GGNumber,glowne,hgg);
except
end;
a to jest ta funkcja z dll'a
function SendMsg(mesg:string;nrGG:integer;Form:TForm1;Hgg:thgg):string; stdcall;
begin
result:='tak';
try
if away.jestem.Checked then
begin
hgg.SendMessage(nrgg,away.txt.Text);
result:='nie';
end;
except
end;
end;
i chodzi o to ze to nie dziala tak jak ma dzialac:
dziala ale tylko za pierwszym razem potem juz nie wysyla wiadomosci
robi to tylko raz.nie wiem juz co robic to pisze :)
thx wszystkim za pomoc