So I tought myself to create a child window and append my menu there instead. Problem is that the menu is not shown with the #WS_CHILD style. It will show just fine with #WS_POPUP style and addtionally hide any window elements like the border and caption. Now there's the next problem. the #WS_CHILD and #WS_POPUP style can't be combined and thus I have to stick with #WS_POPUP alone but the main window and the menu window now behave like to seperate windows, not like parent and child.
Run this to see what I mean:
Code: Select all
Structure NCCALCSIZE_PARAMS
rgrc.RECT[3]
lppos.WINDOWPOS
EndStructure
Procedure WindowCallback(hWnd.l,uMsg.l,wParam.l,lParam.l)
Select uMsg
Case #WM_NCCALCSIZE
*pncc.NCCALCSIZE_PARAMS = lParam
*pncc\rgrc[0]\top + 50
EndSelect
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
OpenWindow(0,0,0,500,400,"untitled",#WS_OVERLAPPEDWINDOW | #WS_VISIBLE | 1)
GetClientRect_(WindowID(0),wrc.RECT)
Result = OpenWindow(#PB_Any,0,50,wrc\right,100,"",#WS_POPUP,WindowID(0))
SetWindowColor(Result,255)
SetParent_(WindowID(Result),WindowID(0))
CreateMenu(0,WindowID(Result))
MenuTitle("File") : For i=1 To 8 : MenuItem(0,"Menu Item #" + Str(i)) : Next
MenuTitle("Edit") : For i=1 To 8 : MenuItem(0,"Menu Item #" + Str(i)) : Next
MenuTitle("Help") : For i=1 To 8 : MenuItem(0,"Menu Item #" + Str(i)) : Next
SetWindowCallback(@WindowCallback())
HideWindow(0,0)
While WaitWindowEvent() ! 16 : Wend
EDIT: Forgot to mention I also tried to change the menubar location by modifying the client area with #WM_NCCALCSIZE message. Didn't work as well.