Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: GetWorkArea Window Resize Place WinPlace X Y Coordinate MulDiv Calculation Pixel Height Width WinMetrics SysParamInfo 48 Task Bar
WinPlace(xulc, yulc, xbrc, ybrc, WinX)If I set yulc = 0, my window's top is at the top of my screen. However, if I set ybrc = 1000 the bottom of my window is covered by the Windows taskbar. How can I find a value for ybrc that will make the bottom of my window go down exactly to the task bar?
The code might look something like this:
sWorkArea = SysParamInfo(48, "", 0) iLeft = ItemExtract(1, sWorkArea, ",") iTop = ItemExtract(2, sWorkArea, ",") iRight = ItemExtract(3, sWorkArea, ",") iBottom = ItemExtract(4, sWorkArea, ",") ; Calculation : WorkArea multiplied by 1000 then divided by actual screen height. ; xulc = iLeft*1000/WinMetrics(0) ; yulc = iTop*1000/WinMetrics(1) ; xbrc = iRight*1000/WinMetrics(0) ; ybrc = iBottom*1000/WinMetrics(1) ; More Precise MulDiv Calculation xulc = DllCall(DirWindows(1):"kernel32.dll",long:"MulDiv",long:iLeft,long:1000,long:WinMetrics(0)) yulc = DllCall(DirWindows(1):"kernel32.dll",long:"MulDiv",long:iTop,long:1000,long:WinMetrics(1)) xbrc = DllCall(DirWindows(1):"kernel32.dll",long:"MulDiv",long:iRight,long:1000,long:WinMetrics(0)) ybrc = DllCall(DirWindows(1):"kernel32.dll",long:"MulDiv",long:iBottom,long:1000,long:WinMetrics(1)) Pause('GetWorkArea Window Resize Results',xulc:',':yulc:',':xbrc:',':ybrc) title = '' ; Blank string refers to the Main WIL window WinPlace( xulc, yulc, xbrc, ybrc, title ) TimeDelay(5) Exit
BoxOpen('GetWorkArea Window Resize','SysParamInfo(48, "", 0) Sample') sWorkArea = SysParamInfo(48,"",0) iLeft = ItemExtract(1, sWorkArea, ",") iTop = ItemExtract(2, sWorkArea, ",") iRight = ItemExtract(3, sWorkArea, ",") iBottom = ItemExtract(4, sWorkArea, ",") ;Place the window using SetWindowPos title = '' ;Blank string refers to the Main WIL window DllCall(DirWindows(1):"user32.dll",long:"SetWindowPos",long:DllHwnd(title),long:0,long:iLeft,long:iTop,long:iRight-iLeft,long:iBottom-iTop,long:4|64) TimeDelay(5) Exit
Article ID: W18459
Filename: GetWorkArea Window Resize.txt
File Created: 2011:11:03:08:55:22
Last Updated: 2011:11:03:08:55:22