home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 December / Chip_2001-12_cd1.bin / zkuste / delphi / kompon / d23456 / CAJSCRTP.ZIP / demo_del / dll.ifs < prev    next >
Text File  |  2001-06-11  |  1KB  |  22 lines

  1. Program IFSTest;
  2. // compile the demo application, minimize delphi and run this. 
  3.  
  4. var 
  5.   i, i2: Longint;
  6.   wnd: Longint;
  7.   Lib: ResourcePointer;
  8. Begin
  9.   if not LoadLibrary('user32.dll', Lib) then begin writeln('Failed');exit;end;
  10.   if not MapLibraryProc(Lib, 'FindWindowA', 'function FindWindow(C1, C2: PChar): Longint; stdcall;') then begin writeln('Failed');exit;end;
  11.   if not MapLibraryProc(Lib, 'ShowWindow', 'function ShowWindow(hWnd, nCmdShow: Longint): Integer; stdcall;') then begin writeln('Failed');exit;end;
  12.   if not MapLibraryProc(Lib, 'SetWindowTextA', 'function SetWindowText(hWnd: Longint; Text: PChar): Longint; stdcall;') then begin writeln('Failed');exit;end;
  13.   wnd := Findwindow('', 'Demo');
  14.   SetWindowText(Wnd, 'This is DLL demo, it calls some windows user32 routines. This will hide this window for a few seconds');
  15.   for i := 0 to 70000 do begin end;
  16.   ShowWindow(Wnd, 0); // hide it
  17.   for i := 0 to 70000 do begin end;
  18.   ShowWindow(Wnd, 5); // show it
  19.   SetWindowText(Wnd, 'Demo');
  20.   CloseLibrary(Lib);
  21. End.
  22.