Shell Class

 

About Shell Class

 

Shell class is mainly used for executing shell commands.

 

Shell Class Methods

 

Shell.Command( string FileName, string Parameters, long Show ) performs an operation on a specified file.

string FileName: specifies the file or object on which to execute the command.
string Parameters: the parameters to be passed to the application.
long Show: controls how an application is to be displayed when it is opened.

Show can be one of the following constants.

SW_FORCEMINIMIZE Minimizes a control, even if the thread that owns the control is not responding. This flag should only be used when minimizing controls from a different thread.

SW_HIDE Hides the control or window and activates another control.

SW_MAXIMIZE Maximizes the specified control.

SW_MINIMIZE Minimizes the specified control and activates the next top-level control in the Z order.

SW_RESTORE Activates and displays the control. If the control is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized control.

SW_SHOW Activates the control and displays it in its current size and position.

SW_SHOWDEFAULT Sets the show state based on the program that started the application.

SW_SHOWMAXIMIZED Activates the control and displays it as a maximized control.

SW_SHOWMINIMIZED Activates the control and displays it as a minimized control.

SW_SHOWMINNOACTIVE Displays the control as a minimized control. This value is similar to SW_SHOWMINIMIZED, except the control is not activated.

SW_SHOWNA Displays the control in its current state. The active control remains active.

SW_SHOWNOACTIVATE Displays a control in its most recent size and position. The active control remains active.

SW_SHOWNORMAL Activates and displays a control. If the control is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the control for the first time.

 

Code Example

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Giavapps.Windows.API;

public class CodeExample : MonoBehaviour
{

private string FileName = "explorer.exe";
private string Parameters = "/select,\"C:\\Windows\\explorer.exe\"";
private long Show = Constant.SW_SHOWNORMAL;

void Start()
{
Plugin.Initialize();//Initializes Giavapps Windows API
}

void Update()
{

//Checks if the specified keyboard key has been pressed
if(Input.GetKeyDown(KeyCode.Space))
{
Shell.Command(FileName, Parameters, Show);//Executes a shell command
}

}

void OnApplicationQuit()
{
Plugin.Deinitialize();//Deinitializes Giavapps Windows API
}

}

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Comments are closed.