this slowpoke moves

Load DLL dynamically and Execute

type
  TShellexecute = function(hWnd: HWND; Operation, FileName, Parameters,
    Directory: PChar; ShowCmd: Integer): HINST; stdcall;
    
//
 
procedure TForm1.Button1Click(Sender: TObject);
var
  hLib: cardinal;
  MyShellExecute: TShellexecute;
begin
  hLib := LoadLibrary('shell32.dll');
  if hLib <> 0 then
  begin
    @MyShellexecute := GetProcAddress(hLib, 'ShellExecuteA');
    if not Assigned(MyShellexecute) then
    begin
      RaiseLastOSError;
      exit;
    end;
  end
  else
  begin
    RaiseLastOSError;
    exit;
  end;
  MyShellexecute(Form1.Handle, 'open', 'Notepad.exe', nil, nil, SW_NORMAL);
end; 

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate