Author Topic: Получение hwnd активного окна  (Read 2161 times)

0 Members and 1 Guest are viewing this topic.

ya12

  • Активный участник
  • ***
  • Posts: 165
    • View Profile
Получение hwnd активного окна
« on: April 14, 2019, 01:10:11 PM »
Code: (delphi) [Select]

library GetFocus1;
uses
  TlHelp32, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
//------------------------------------------------------------------------------
// Основное тело функции, идет на экспорт, вызывается из кликера
function execute(_mas: pInteger; _size: Integer): Integer; export; stdcall;
type
  pIntArr = array[0..0] of Integer;
var
  Currentid, id:DWORD;
begin
  id := GetWindowThreadProcessId(GetForegroundWindow, nil);
  Currentid := GetCurrentThreadId;
  AttachThreadInput(Currentid, id, true);
  result:=GetFocus;
  AttachThreadInput(Currentid, id, false);
end;
//------------------------------------------------------------------------------

// список экспорта
exports execute;

begin
  // тело пусто
end.



Code: (clickermann) [Select]
call("GetFocus1.dll")
print($_return1)
halt