如题
------解决方案--------------------
声明API
FUNCTION ulong FindWindow(ref string lpClassName,ref string lpWindowName) LIBRARY "user32.dll" ALIAS FOR "FindWindowA"
FUNCTION ulong GetClientRect(ulong hwnd,ref RECT lpRect) LIBRARY "user32.dll"
定义结构体 rect
global type rect from structure
long left
long top
long right
long bottom
end type
代码如下:
Long Getwnd
RECT Rect1
string ls, ls_classname = 'Shell_TrayWnd'
Getwnd = FindWindow( ls_classname, ls)
if getwnd > 0 then
GetClientRect(Getwnd, Rect1 )
MessageBox('提示', "任务栏高度:" + string(Rect1.Bottom) + '像素~r~n任务栏宽度:' + string( Rect1.Right) + '像素')
end if
------解决方案--------------------
在 Getwnd = FindWindow( ls_classname, ls)
前加上 SetNull(ls) 试试