开发者

How can I check to see if the active window is maximized with vbs?

When I'm working, I want to be able to maximize or restore a window. B开发者_如何学JAVAut I only want to use one shortcut key to do it. I am currently using the below code to perform the function of maximizing. However, if the window is already maximized, this won't 'restore' the window.

Set oShell = CreateObject("WScript.Shell") 
oShell.SendKeys "% x"

I guess I'm thinking of code like this:

if window state=Maximized 
then Restore
else Maximize

This logic will 'maximize' the window if it isn't and 'restore' it if it is.

Thanks.

PS: Extra points if you skip the whole SendKeys thing and go straight to native commands.


VBScript and Windows Script Host don't provide access to Windows API, so you can't do that.

A possible workaround is to write a custom utility (in C++, C# with PInvoke etc) that will perform this kind of check and call it from your script.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜