WindowStyle Property

 

Description

 

Assigns a window style to a shortcut, or identifies the type of window style used by a shortcut.

 

PowerBASIC Syntax

 

PROPERTY GET WindowStyle () AS LONG

PROPERTY SET WindowStyle(BYVAL nWindowStyle AS LONG)

 

Arguments

 

nWindowStyle

LONG. The window style for the program being run.

 

Remarks

 

The following table lists the available settings for nWindowStyle.

 

nWindowStyle

Description

1

Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position.

3

Activates the window and displays it as a maximized window.

7

Minimizes the window and activates the next top-level window.

 

Example [PowerBASIC]

 

#INCLUDE "WSHOM.INC"

 

' Creates an instance of the Windows Script Host

LOCAL pWsh AS IWshShell

pWsh = NEWCOM "WScript.Shell"

 

' Creates a shortcut programatically (if it already exists, CreateShortcut opens it)

LOCAL pLnk AS IWshShortcut

pLnk = pWsh.CreateShortcut(UCODE$(EXE.PATH$ & "Test.lnk"))

 

' Sets variuos properties and saves them to disk

pLnk.Description = UCODE$("Hello world")

pLnk.WorkingDirectory = UCODE$(EXE.PATH$)

pLnk.Arguments = UCODE$("/c")

pLnk.HotKey = UCODE$("Ctrl+Alt+e")

pLnk.IconLocation = UCODE$(EXE.PATH$ & "PROGRAM.ICO,0")

pLnk.RelativePath = UCODE$(EXE.PATH$)

pLnk.TargetPath = UCODE$(EXE.PATH$ & "EX_WHLNK_CreateShortcut.EXE")

pLnk.WindowStyle = %WshNormalFocus

pLnk.Save

 

' Get the parameters to to see if they have changed

STDOUT "Shortcut description: " & ACODE$(pLnk.Description)

STDOUT "Shortcut working directory: " & ACODE$(pLnk.WorkingDirectory)

STDOUT "Shortcut arguments: " & ACODE$(pLnk.Arguments)

STDOUT "Shortcut hot key: " & ACODE$(pLnk.HotKey)

STDOUT "Shortcut icon location: " & ACODE$(pLnk.IconLocation)

STDOUT "Shortcut target path: " & ACODE$(pLnk.TargetPath)

STDOUT "Shortcut window style: " & FORMAT$(pLnk.WindowStyle)

 

Valid XHTML 1.0 Transitional