Imports System.Runtime.InteropServices Module LoadIcon Private Const IDI_APPLICATION = 32512 ' Declare the LoadIcon function Private Declare Function LoadIcon Lib "user32" Alias "LoadIconA" (ByVal hInstance As IntPtr, ByVal lpszName As Integer) As IntPtr Sub LoadIcon_Main() ' Load the icon from a file Dim icon As IntPtr = LoadIcon(0, IDI_APPLICATION) If icon Then ' Use the icon ' ... End If ' Free the icon Marshal.FreeHGlobal(icon) End Sub End Module