If you just need to create a window for OpenGL, and you don't want to import MaxGUI, use this:
Framework pub.win32 Import brl.retro Import brl.system Extern "win32" Function GetLastError:Int() Function FreeLibrary:Int(hModule:Int) EndExtern Const WINDOW_TITLEBAR=1 Const WINDOW_RESIZABLE=2 Const WINDOW_MENU=4 Const WINDOW_STATUS=8 Const WINDOW_TOOL=16 Const WINDOW_CLIENTCOORDS=32 Const WINDOW_HIDDEN=64 Const WINDOW_ACCEPTFILES=128 Const WINDOW_CHILD=256 Const WINDOW_DIALOG=512 Const WINDOW_CENTER=1024 Global ClassAtom Type TWindow Global list:TList=New TList Field link:TLink Field hWnd Method New() link=list.addfirst(Self) EndMethod Method Kill() If hwnd DestroyWindow hwnd EndMethod EndType CreateWindow("My Bad Window",200,200,400,300,0,WINDOW_TITLEBAR|WINDOW_RESIZABLE) Delay 1000 If EndWindows() Notify "Everything went okay!" Function EndWindows:Int() If ClassAtom For window:TWindow=EachIn TWindow.list window.kill() Next Local UnregisterClassW:Int(lpClassName:Int,hInstance:Int) lib=loadlibrarya("user32.dll") UnregisterClassW=getprocaddress(lib,"UnregisterClassW") If Not UnregisterClassW(ClassAtom,GetModuleHandleW(Null)) Notify "Failed to release window class." freelibrary lib ClassAtom=0 Return True EndIf EndFunction Function CreateWindow:TWindow(title$,x:Int,y:Int,w:Int,h:Int,group:TWindow=Null,style=WINDOW_TITLEBAR|WINDOW_RESIZABLE) If Not ClassAtom WindowClass:WNDCLASSW=New WNDCLASSW name$="LEADWERKS_WINDOW_CLASS" icon=LoadIconW(GetModuleHandleW(Null),Short Ptr(101)) WindowClass.style=CS_OWNDC|CS_HREDRAW|CS_VREDRAW WindowClass.lpfnWndProc=ClassWndProc WindowClass.hInstance=GetModuleHandleW(Null) WindowClass.hIcon=icon WindowClass.hCursor=LoadCursorW(0,Short Ptr(IDC_ARROW)) WindowClass.hbrBackground=COLOR_BTNSHADOW WindowClass.lpszMenuName=Null WindowClass.lpszClassName=name.ToWString() WindowClass.cbWndExtra=DLGWINDOWEXTRA ClassAtom=RegisterClassW(WindowClass) If Not ClassAtom WindowClass=Null Notify "Failed to initialize window class." Return EndIf EndIf wstyle=WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS xstyle=0 If style&WINDOW_TITLEBAR wstyle:|WS_CAPTION|WS_SYSMENU If style&WINDOW_RESIZABLE wstyle:|WS_MINIMIZEBOX|WS_MAXIMIZEBOX Else wstyle:|WS_POPUP EndIf If style&WINDOW_RESIZABLE wstyle:|WS_SIZEBOX EndIf If style&WINDOW_TOOL xstyle:|WS_EX_TOOLWINDOW EndIf If style&WINDOW_HIDDEN wstyle:&~WS_VISIBLE End If If group<>Null parenthwnd=group.hwnd wstyle:|WS_CHILD EndIf window:TWindow=New TWindow window.hwnd=CreateWindowExW(xstyle,"LEADWERKS_WINDOW_CLASS",title$,wstyle,x,y,w,h,parenthwnd,0,GetModuleHandleW(Null),Null) If Not window.hwnd Notify GetLastError() Notify "Failed to create window." Return EndIf Return window EndFunction Function ClassWndProc(hwnd,msg,wp,lp) "win32" nodebug Select msg Case WM_COMMAND Case WM_NOTIFY End Select Return DefWindowProcW( hwnd,msg,wp,lp ) End Function