用API函数GetMenu获得sheet窗口的菜单地址,可怎么也得不到
编号:QA004298
建立日期: 2001年7月9日 最后修改日期:2001年7月9日
所属类别:
jackson:
操作系统:win98
编程工具:Power Builder/Windows API
问题:有MDI和sheet窗口,我想让sheet窗口的菜单图形化。我想用API函数GetMenu获得sheet窗口的菜单地址可怎么也得不到,如果不用MDI窗口,而是直接用main窗口是可以的!代码如下:
Long ll_MainHandle
long ll_SubMenuHandle
long ll_MenuItemID
long ll_BitmapHandleA
long ll_BitmapHandleB
// Win32 contants
Integer IMAGE_BITMAP = 0
Integer LR_LOADFROMFILE = 16
Integer SM_CXMENUCHECK = 71
Integer SM_CYMENUCHECK = 72
Integer MF_BITMAP = 4
Integer MF_BYCOMMAND = 0
Integer MF_BYPOSITION = 1024
// Get a handle to the menu
//sheet窗口不能得到
ll_MainHandle = GetMenu(handle(this))
// Get a handle the the first menu item
ll_SubMenuHandle = GetSubMenu(ll_MainHandle,0)
// Load the images in their original sizes
ll_BitmapHandleA = LoadImageA(0,'ok.bmp',0,0,0,LR_LOADFROMFILE)
ll_BitmapHandleB = LoadImageA(0,'stop.bmp',0,0,0,LR_LOADFROMFILE)
// get the menu id of the first submenu item
li_MenuItemID = GetMenuItemID(ll_SubMenuHandle,0)
ModifyMenu(ll_SubMenuHandle,li_MenuItemID,MF_BITMAP,li_MenuItemId,ll_BitmapHandleA)
// get the menu id of the first submenu item
li_MenuItemID = GetMenuItemID(ll_SubMenuHandle,1)
ModifyMenu(ll_SubMenuHandle,li_MenuItemID,MF_BITMAP,li_MenuItemId,ll_BitmapHandleB)
回答:
您输入的参数是MDI窗体的句柄还是SHEET窗体的句柄,若是SHEET窗口的句柄请先获得MDI窗体的句柄。
此问题由bighead回答。
| |
|
|
| |
|
|