IPAddress Class

 

 

About IPAddress Class

 

IPAddress class is mainly used for creating and managing IP address controls.

 

IPAddress Class Methods

 

IPAddress.Create( long ParentHandle, long X, long Y, long Width, long Height, long Style, long ExStyle ) creates an IP address control. 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 style.
long ExStyle: the extended style of the control being created. This parameter can be a combination of the extended window styles.

 

IPAddress.Exists( long IPAddressHandle ) returns true if the specified control was created with IPAddress.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 IPAddressHandle: IP address control handle.

 

IPAddress.Count() returns the total number of controls created with IPAddress.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.

 

IPAddress.GetHandleByIndex( ulong IPAddressIndex ) returns the handle from an index if the specified control was created with IPAddress.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. IPAddressIndex parameter should be less or equal to IPAddress.Count()-1.

ulong IPAddressIndex: zero-based index of the IP address control.

 

IPAddress.SetAddress( long IPAddressHandle, long Field0, long Field1, long Field2, long Field3 ) sets the address values for all four fields in the IP address control.

long IPAddressHandle: IP address control handle.
long Field0: identifies the first field. This argument can be a value from 0 to 255.
long Field1: identifies the second field. This argument can be a value from 0 to 255.
long Field2: identifies the third field. This argument can be a value from 0 to 255.
long Field3: identifies the fourth field. This argument can be a value from 0 to 255.

 

IPAddress.GetAddress( long IPAddressHandle, ulong FieldIndex ) returns the address values for one of four fields in the IP address control or -1 if you input an invalid field index.

long IPAddressHandle: IP address control handle.
ulong FieldIndex: zero-based index of the field.

 

IPAddress.ClearAddress( long IPAddressHandle ) clears the contents of the IP address control.

long IPAddressHandle: IP address control handle.

 

IPAddress.GetBlank( long IPAddressHandle ) Determines if all fields in the IP address control are blank.

long IPAddressHandle: IP address control handle.

 

IPAddress.SetFocus( long IPAddressHandle, ulong FieldIndex ) sets the keyboard focus to the specified field in the IP address control. All of the text in that field will be selected.

long IPAddressHandle: IP address control handle.
ulong FieldIndex: zero-based index of the field.

 

IPAddress.SetRange( long IPAddressHandle, ulong FieldIndex, long Minimum, long Maximum ) sets the valid range for the specified field in the IP address control.

long IPAddressHandle: IP address control handle.
ulong FieldIndex: zero-based index of the field.
long Minimum: the minimum limit of the range.
long Maximum: the maximum limit of the range.

 

IPAddress.SetChanged( long IPAddressHandle, bool Changed ) sets the change state of the IP address control.

long IPAddressHandle: IP address control handle.
bool Changed: sets the IP address control as changed (true) or not (false).

 

IPAddress.GetChanged( long IPAddressHandle ) returns the change state of the IP address control.

long IPAddressHandle: IP address control 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 IPAddressHandle = 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
IPAddressHandle = IPAddress.Create(WindowHandle, 10, 10, 150, 32, Constant.WS_VISIBLE | Constant.WS_CHILD, 0);//creates a new IP address control
}

void Update()
{

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

//Checks if the specified IP address control has changed
if(IPAddress.GetChanged(IPAddressHandle))
{
Debug.Log("IPADDRESS CHANGED!");
}

}

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.