用ChatGPT写了一段Lua脚本没反应,如下:
function wgAction()
-- 定义目标窗口大小
local targetWidth = 800
local targetHeight = 600
-- 获取屏幕大小
local screenWidth = User32.GetSystemMetrics(0) -- SM_CXSCREEN = 0
local screenHeight = User32.GetSystemMetrics(1) -- SM_CYSCREEN = 1
-- 计算窗口应该放置的位置
local x = (screenWidth - targetWidth) / 2
local y = (screenHeight - targetHeight) / 2
-- 获取当前活动窗口的句柄
local hwnd = User32.GetForegroundWindow()
-- 设置窗口大小和位置
-- SWP_NOZORDER = 0x0004, SWP_NOACTIVATE = 0x0010
User32.SetWindowPos(hwnd, 0, x, y, targetWidth, targetHeight, 0x0004 + 0x0010)
end
function wgAction()
-- 定义目标窗口大小
local targetWidth = 800
local targetHeight = 600
-- 获取屏幕大小
local screenWidth = User32.GetSystemMetrics(0) -- SM_CXSCREEN = 0
local screenHeight = User32.GetSystemMetrics(1) -- SM_CYSCREEN = 1
-- 计算窗口应该放置的位置
local x = (screenWidth - targetWidth) / 2
local y = (screenHeight - targetHeight) / 2
-- 获取当前活动窗口的句柄
local hwnd = User32.GetForegroundWindow()
-- 设置窗口大小和位置
-- SWP_NOZORDER = 0x0004, SWP_NOACTIVATE = 0x0010
User32.SetWindowPos(hwnd, 0, x, y, targetWidth, targetHeight, 0x0004 + 0x0010)
end