You can try win32 { GetMenu( hwnd ) } on a window Query(QUERY_HWND) to get the root menu.
eg
Local mainmenu=GetMenu(WindowMenu(window).query(QUERY_HWND))
The demo below works so shouldnt be to hard to change to suit multiple images etc
The only problem is when you later come to UncheckMenu/CheckMenu. You'll loose the image totally so really its a little dodgey doing it this way.
eg
Local mainmenu=GetMenu(WindowMenu(window).query(QUERY_HWND))
The demo below works so shouldnt be to hard to change to suit multiple images etc
The only problem is when you later come to UncheckMenu/CheckMenu. You'll loose the image totally so really its a little dodgey doing it this way.
'checkmenu image change 'by Birdie Strict Extern "win32" Function LoadImage_( hInst, fName$z, uType, dx, dy, fuLoad ) = "LoadImageA@24" Function SetMenuItemBitmaps( hMenu, uPosition, uFlags, hBitUnChecked, hBitChecked ) = "SetMenuItemBitmaps@20" Function GetMenu( hWnd ) = "GetMenu@4" Function GetSubMenu( hMenu, pos ) = "GetSubMenu@8" EndExtern Local window:TGadget = CreateWindow("Test",0,0,640,480,Desktop(),WINDOW_MENU|WINDOW_TITLEBAR|WINDOW_STATUS) Local file:TGadget = CreateMenu("&File",1,WindowMenu(window)) Local open:TGadget = CreateMenu("Open",101,file) CreateMenu("Save",102,file) CreateMenu("Exit",199,file) Local edit:TGadget = CreateMenu("Edit",201,WindowMenu(window)) CreateMenu("Paste",202,edit) UpdateWindowMenu WindowMenu(window) Local bi = loadimage_( 0,CurrentDir()+"/logo.bmp",0,0,0,$10 ) Local mainmenu=GetMenu(WindowMenu(window).query(QUERY_HWND)) AddImage mainmenu, bi While WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End EndSelect Wend Function AddImage( root_menu, bitmap ) Local INDEX=0 Local sub_menu Local done = 0 Repeat sub_menu = GetSubMenu( root_menu, index ) If sub_menu AddImage sub_menu,bitmap EndIf If SetMenuItemBitmaps( root_menu, index, MF_BYPOSITION, bitmap, bitmap ) = 0 done = True EndIf index :+1 Until done EndFunction