local ffi = require('ffi')
if ffi.arch == 'x64' then
ffi.cdef'typedef unsigned __int64 UINT_PTR;'
ffi.cdef'typedef __int64 LONG_PTR;'
ffi.cdef'unsigned __int64 ULONG_PTR;'
else
ffi.cdef'typedef unsigned int UINT_PTR;'
ffi.cdef'typedef long LONG_PTR;'
ffi.cdef'typedef unsigned long ULONG_PTR;'
end
ffi.cdef [[
typedef unsigned long HANDLE;
typedef HANDLE HWND;
typedef unsigned int uint;
typedef LONG_PTR lresult;
typedef LONG_PTR LPARAM;
typedef UINT_PTR WPARAM;
typedef void *PVOID;
typedef struct _RECT {
long left;
long top;
long right;
long bottom;
} RECT, *PRECT;
HWND GetActiveWindow(void);
bool SetWindowPos(
HWND hWnd,
HWND hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
uint uFlags
);
lresult SendMessageA(
HWND hWnd,
uint Msg,
WPARAM wParam,
LPARAM lParam
);
bool SystemParametersInfoA(
uint uiAction,
uint uiParam,
PVOID pvParam,
uint fWinIni
);
int GetSystemMetrics(
int nIndex
);
bool GetWindowRect(
HWND hWnd,
PRECT lpRect
);
]]
local szx = ffi.C.GetSystemMetrics(0);
local szy = ffi.C.GetSystemMetrics(1);
print(szx)
print(szy)
local rect = ffi.new('RECT', 0)
ffi.C.GetWindowRect(ffi.C.GetActiveWindow(),rect);
local cszx = rect.right - rect.left
local cszy = rect.bottom - rect.top
print(cszx)
print(cszy)
if szx == cszx and szy == cszy then
ffi.C.SendMessageA(ffi.C.GetActiveWindow(), 0x0104, 0x00000012, 0x20380001);
ffi.C.SendMessageA(ffi.C.GetActiveWindow(), 0x0104, 0x0000000D, 0x201C0001);
ffi.C.SendMessageA(ffi.C.GetActiveWindow(), 0x0106, 0x0000000D, 0x201C0001);
ffi.C.SendMessageA(ffi.C.GetActiveWindow(), 0x0105, 0x0000000D, 0xE01C0001);
ffi.C.SendMessageA(ffi.C.GetActiveWindow(), 0x0101, 0x00000012, 0xC0380001);
ffi.C.SetWindowPos(ffi.C.GetActiveWindow(), -1, 1, 1, 640,480,0x0200)
end