动态调用DLL

   Var
  LibHandle:HWND;
  DllName:Procedure(DllHandle:HWND);Stdcall;
  
  
  LibHandle:=LoadLibrary('MyDll.dll');
  if LibHandle<32 then
  begin
  MessageBox(Form1.Handle,'Not Found MyDll.dll','Error',0);
  Exit;
  end;
  @DllName:=GetProcAddress(LibHandle,'View');
  if @DllName=NIL then
  begin
  MessageBox(Form1.Handle,'Not Found View in MyDll.dll','Error',0);
  FreeLibrary(LibHandle);
  Exit;
  end;
  try
  View(Application.Handle);
  finally
  FreeLibrary(LibHandle);
  end;
  
  
  /**************************
  动态调用DLL
  implementation
  
  Procedure View(Ehandle:HWnd);Stdcall;External 'MyDll.dll'; 

你可能感兴趣的:(dll)