procedure Test; begin ShowMessage('Procédure Test'); end; function FindProc(ProcName: string): string; var H: HModule; P: procedure; begin Result := EmptyStr; H := GetModuleHandle(nil); if H <> 0 then begin P := GetProcAddress(H, PChar(ProcName)); if Assigned(P) then begin P; Result := Format('"%s" found at %p', [ProcName, @@P]); end else Result := ProcName + ' not found'; end; end; procedure TForm1.btnFindProcClick(Sender: TObject); begin Memo1.Lines.Add(FindProc(EdProcName.Text)); end; exports Test;
procedure appel_fonction(nom_fonction : String); begin if nom_fonction = Fonction1 then Fonction1 else if nom_fonction = Fonction2 then Fonction2 else if nom_fonction = Fonction3 then Fonction3; ... end;
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionTProcedure2Param = procedure(Param1, Param2: String); TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Déclarations privées } public { Déclarations publiques } end; Procedure Stuff(Param1, Param2: String); Procedure ReStuff(Param1, Param2: String); var Form1: TForm1; Procedure2Param: TProcedure2Param; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin @Procedure2Param := @Stuff; Procedure2Param('a', 'b'); @Procedure2Param := @ReStuff; Procedure2Param('a', 'b'); end; Procedure Stuff(Param1, Param2: String); Begin ShowMessage('Stuff'); End; Procedure ReStuff(Param1, Param2: String); Begin ShowMessage('ReStuff'); End;