Icon Class


About Icon Class


Icon class is mainly used for loading and managing icons.


Icon Class Methods


Icon.Add( string FileName ) Adds an .ICO file. If the function succeeds, the return value is the handle of the newly loaded resource. If the function fails, the return value is 0.

string FileName: the name of the file.


Icon.Delete( long IconHandle ) Deletes an icon and frees any memory the icon occupied. If the function succeeds, the return value is true. If the function fails, the return value is false.

long IconHandle: icon 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 IconHandle = 0;

void Start()
Plugin.Initialize();//Initializes Giavapps Windows API
IconHandle = Icon.Add("icon.ico");//adds a new icon
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
Window.SetIcon(WindowHandle, IconHandle, Constant.ICON_SMALL);//Sets the previously added icon to the window
Control.SetText(WindowHandle, "Giavapps Windows API");//Sets a new title for the specified window

void Update()

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


void OnApplicationQuit()
Icon.Delete(IconHandle);//deletes the previously added icon
Plugin.Deinitialize();//Deinitializes Giavapps Windows API



Comments are closed.