Well, after taking a peek at maxgui.win32maxguiex, I made this.
Strict
Import maxgui.drivers
Import maxgui.win32maxguiex
Import pub.win32
Graphics(640, 480)
Global Window:TGadget = CreateWindowFromHwnd(GetActiveWindow( ), WINDOW_MENU|WINDOW_STATUS)
Global File:TGadget = CreateMenu("&File", 0, Window.GetMenu( ))
CreateMenu("E&xit", 100, File)
UpdateWindowMenu( Window )
Repeat
PollEvent( )
Select EventID( )
Case EVENT_MENUACTION
Select EventData()
Case 100
End
End Select
End Select
Cls( )
Flip( )
Until (KeyHit(KEY_ESCAPE))
Function CreateWindowFromHwnd:TGadget(hWnd:Int, Style:Int = 15)
' Local objects:
Local OldStyle:Int
Local NewStyle:Int
Local Client:Int
Local Window:TWindowsWindow = New TWindowsWindow
Local _wstrEmpty:Byte Ptr
If (Style & WINDOW_MENU)
Window._hmenu = CreateMenu_( )
AppendMenuW(Window._hmenu, MF_STRING, Null, _wstrEmpty)
EndIf
Window.Register(GADGET_WINDOW, hWnd, Client, False)
Return( Window )
End Function
Using this code, I was able to use a MaxGUI menu window a Max2D window. and of course, due to the nature of this code, it's Win32 flavor only.
|