ProgressBar Class

 

 

About ProgressBar Class

 

ProgressBar class is mainly used for creating and managing progress bars.

 

ProgressBar Class Methods

 

ProgressBar.Create( long ParentHandle, long X, long Y, long Width, long Height, long Style, long ExStyle ) creates a progress bar. If the function succeeds, the return value is a handle to the new control. If the function fails, the return value is 0.

long ParentHandle: a handle to the parent or owner control of the control being created.
long X: x coordinate. You can also use CW_USEDEFAULT constant for this argument.
long Y: y coordinate. You can also use CW_USEDEFAULT constant for this argument.
long Width: width. You can also use CW_USEDEFAULT constant for this argument.
long Height: height. You can also use CW_USEDEFAULT constant for this argument.
long Style: the style of the control being created. This parameter can be a combination of the window styles and progress bar styles.
long ExStyle: the extended style of the control being created. This parameter can be a combination of the extended window styles.

 

ProgressBar.Exists( long ProgressBarHandle ) returns true if the specified control was created with ProgressBar.Create() method and not destroyed yet or false otherwise. Note that all child controls are destroyed when parent control is destroyed. You can also call Control.Destroy() method for destroying a specific control with all of its children.

long ProgressBarHandle: progress bar handle.

 

ProgressBar.Count() returns the total number of controls created with ProgressBar.Create() method and not destroyed yet. Note that all child controls are destroyed when parent control is destroyed. You can also call Control.Destroy() method for destroying a specific control with all of its children.

 

ProgressBar.GetHandleByIndex( ulong ProgressBarIndex ) returns the handle from an index if the specified control was created with ProgressBar.Create() method and not destroyed yet or 0 otherwise. Note that all child controls are destroyed when parent control is destroyed. You can also call Control.Destroy() method for destroying a specific control with all of its children. ProgressBarIndex parameter should be less or equal to ProgressBar.Count()-1.

ulong ProgressBarIndex: zero-based index of the progress bar.

 

ProgressBar.SetRange( long ProgressBarHandle, long Minimum, long Maximum ) sets the minimum and maximum values for a progress bar and redraws the bar to reflect the new range.

long ProgressBarHandle: progress bar handle.
long Minimum: minimum range value. By default, the minimum value is 0.
long Maximum: maximum range value. This value must be greater than Minimum. By default, the maximum value is 100.

 

ProgressBar.GetRange( long ProgressBarHandle, bool MinimumOrMaximum ) retrieves information about the current minimum and maximum values of a given progress bar control.

long ProgressBarHandle: progress bar handle.
bool MinimumOrMaximum: returns the minimum value (false) or the maximum value (true).

 

ProgressBar.SetPosition( long ProgressBarHandle, long Position ) sets the current position for a progress bar and redraws the bar to reflect the new position.

long ProgressBarHandle: progress bar handle.
long Position: integer that becomes the new position.

 

ProgressBar.GetPosition( long ProgressBarHandle ) retrieves information about the current position of a given progress bar control.

long ProgressBarHandle: progress bar handle.

 

ProgressBar.Step( long ProgressBarHandle ) advances the current position for a progress bar by the step increment and redraws the bar to reflect the new position. An application sets the step increment by calling ProgressBar.SetStep() method. This function returns the previous position.

long ProgressBarHandle: progress bar handle.

 

ProgressBar.SetStep( long ProgressBarHandle, long Increment ) specifies the step increment for a progress bar. The step increment is the amount by which the progress bar increases its current position whenever you call ProgressBar.Step() method. By default, the step increment is set to 10. This function returns the previous step increment.

long ProgressBarHandle: progress bar handle.
long Increment: step increment.

 

ProgressBar.GetStep( long ProgressBarHandle ) retrieves the step increment from a progress bar. The step increment is the amount by which the progress bar increases its current position whenever you call ProgressBar.Step() method. By default, the step increment is set to 10.

long ProgressBarHandle: progress bar handle.

 

ProgressBar.StepBy( long ProgressBarHandle, long Increment ) advances the current position of a progress bar by a specified increment and redraws the bar to reflect the new position. The function returns the previous position.

long ProgressBarHandle: progress bar handle.
long Increment: step increment.

 

ProgressBar.SetState( long ProgressBarHandle, long State ) sets the state of the progress bar. This function returns the previous state.

long ProgressBarHandle: progress bar handle.
long State: state of the progress bar that is being set.

State parameter can be one of the following constants.

PBST_NORMAL In progress.

PBST_ERROR Error.

PBST_PAUSED Paused.

 

ProgressBar.GetState( long ProgressBarHandle ) gets the state of the progress bar.

long ProgressBarHandle: progress bar handle.

Return value can be one of the following constants.

PBST_NORMAL In progress.

PBST_ERROR Error.

PBST_PAUSED Paused.

 

ProgressBar.SetMarquee( long ProgressBarHandle, bool Enabled, long Time ) sets the progress bar to marquee mode. This causes the progress bar to move like a marquee. (This method only works on progress bars with PBS_MARQUEE style)

long ProgressBarHandle: progress bar handle.
bool Enabled: turns on (true) or off (false) marquee mode.
long Time: time, in milliseconds, between marquee animation updates. If this parameter is 0, the marquee animation is updated every 30 milliseconds.

 

ProgressBar.SetColorBar( long ProgressBarHandle, long Color ) sets the color of the progress indicator bar in the progress bar control. Returns the previous progress indicator bar color, or CLR_DEFAULT if the progress indicator bar color is the default color. Note that this method turns off visual styles for the specified control in order to see the result.

long ProgressBarHandle: progress bar handle.
long Color: 24-bit color. Specifying the CLR_DEFAULT value causes the control to use its default color.

 

ProgressBar.GetColorBar( long ProgressBarHandle ) gets the color of the progress bar.

long ProgressBarHandle: progress bar handle.

 

ProgressBar.SetColorBackground( long ProgressBarHandle, long Color ) sets the background color in the progress bar. Returns the previous background color, or CLR_DEFAULT if the background color is the default color. Note that this method turns off visual styles for the specified control in order to see the result.

long ProgressBarHandle: progress bar handle.
long Color: 24-bit color. Specifying the CLR_DEFAULT value causes the control to use its default color.

 

ProgressBar.GetColorBackground( long ProgressBarHandle ) gets the background color of the progress bar.

long ProgressBarHandle: progress bar handle.

 

Code Example

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

public class CodeExample : MonoBehaviour
{

private long WindowHandle = 0;
private long ProgressBarHandle = 0;

void Start()
{
Plugin.Initialize();//Initializes Giavapps Windows API
WindowHandle = Window.Create(0, 100, 100, 400, 400, Constant.WS_VISIBLE | Constant.WS_SYSMENU | Constant.WS_MINIMIZEBOX | Constant.WS_MAXIMIZEBOX | Constant.WS_SIZEBOX, Constant.WS_EX_TOPMOST);//Creates a new window
Control.SetText(WindowHandle, "Giavapps Windows API");//Sets a new title for the specified window
ProgressBarHandle = ProgressBar.Create(WindowHandle, 10, 10, 150, 32, Constant.WS_VISIBLE | Constant.WS_CHILD, 0);//Creates a new progress bar
ProgressBar.SetPosition(ProgressBarHandle, 40);//Sets a new position for the specified progress bar
}

void Update()
{

//Checks if the specified window has been closed
if(Window.GetClosed(WindowHandle))
{
Control.Destroy(WindowHandle);//Destroys the specified window
}

}

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.