Guest User

Untitled

a guest
Apr 21st, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.01 KB | None | 0 0
  1. {============================ ProjectEXE.dpr ============================}
  2. program ProjectEXE;
  3.  
  4. uses
  5.   ShareMem{!!!}, Windows;
  6.  
  7. function Example(const lpText: PChar): BOOL; export; stdcall;
  8. begin
  9.   Result := (lpText <> nil);
  10.   if Result then
  11.     MessageBox(0, lpText, 'Example', MB_ICONINFORMATION);
  12. end;
  13.  
  14. procedure LoadDLL;
  15. var
  16.   hLib : DWORD;
  17. begin
  18.   hLib := LoadLibrary('ProjectDLL.dll');
  19.   if hLib <> 0 then
  20.     FreeLibrary(hLib)
  21.   else
  22.     MessageBox(0, 'Can''t load DLL', 'Error', MB_ICONERROR);
  23. end;
  24.  
  25. exports
  26.   Example name 'Example';
  27.  
  28. begin
  29.   LoadDLL;
  30. end.
  31. {============================ uExportEXE.pas ============================}
  32. unit uExportEXE;
  33.  
  34. interface
  35.  
  36. uses
  37.   Windows;
  38.  
  39.   function Example(const lpText: PChar): BOOL; stdcall;
  40.   external 'ProjectEXE.exe' name 'Example';
  41.  
  42. implementation
  43.  
  44. end.
  45. {============================ ProjectDLL.dpr ============================}
  46. library ProjectDLL;
  47.  
  48. uses
  49.   ShareMem{!!!}, uExportEXE;
  50.  
  51. begin
  52.   Example('EXE export example');
  53. end.
Add Comment
Please, Sign In to add comment