為快捷方式指派窗口樣式,或確定快捷方式使用的的窗口樣式類型。
object.WindowStyle = intWindowStyle
WindowStyle 屬性返回一個整數(shù)。
下表列出了 intWindowStyle 的可用設置。
intWindowStyle | 說明 |
---|---|
1 | 激活并顯示窗口。如果該窗口被最小化或最大化,則系統(tǒng)將其還原到初始大小和位置。 |
3 | 激活窗口并將其顯示為最大化窗口。 |
7 | 最小化窗口并激活下一個頂級窗口。 |
下面的示例演示 WindowStyle 屬性的用法:
<package> <job id="vbs"> <script language="VBScript"> set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk") oShellLink.TargetPath = WScript.ScriptFullName oShellLink.WindowStyle
= 1 oShellLink.Hotkey = "Ctrl+Alt+e" oShellLink.IconLocation = "notepad.exe, 0" oShellLink.Description = "Shortcut Script" oShellLink.WorkingDirectory = strDesktop oShellLink.Save set oUrlLink = WshShell.CreateShortcut(strDesktop & "\Microsoft Web Site.url") oUrlLink.TargetPath = "http://www.microsoft.com/china" oUrlLink.Save </script> </job> <job id="js"> <script language="JScript"> var WshShell = WScript.CreateObject("WScript.Shell"); strDesktop = WshShell.SpecialFolders("Desktop"); var oShellLink = WshShell.CreateShortcut(strDesktop + "\\Shortcut Script.lnk"); oShellLink.TargetPath = WScript.ScriptFullName; oShellLink.WindowStyle
= 1; oShellLink.Hotkey = "Ctrl+Alt+e"; oShellLink.IconLocation = "notepad.exe, 0"; oShellLink.Description = "Shortcut Script"; oShellLink.WorkingDirectory = strDesktop; oShellLink.Save(); var oUrlLink = WshShell.CreateShortcut(strDesktop + "\\Microsoft Web Site.url"); oUrlLink.TargetPath = "http://www.microsoft.com/china"; oUrlLink.Save(); </script> </job> </package>