Well, I'm giving up on it for now. The following code works to an extent. The icon is visible in the task bar, but not on the window itself. If anyone knows how to make it appear in both places, please let me know. Thanks to everyone who offered help.
Import "-lkernel32" Import "-lshell32" Extern "win32" Function GetActiveWindow() = "GetActiveWindow@0" Function SetClassLong(hWnd, nIndex, dwNewLong) = "SetClassLongA@12" Function GetLastError() = "GetLastError@0" Function LoadIcon(hWnd, file:Byte Ptr, index) = "ExtractIconA@12" End Extern Graphics 320, 240, 0 Local hWnd = GetActiveWindow() Print "hWnd: " + hWnd Local icon = LoadIcon(hWnd, "icon.ico", 0) Print "icon: " + icon Local ret = SetClassLong(hWnd, -14, icon) Print "ret: " + ret 'If Not ret Then Notify GetLastError() Repeat; FlushMem; Flip; Until KeyDown(KEY_ESCAPE)