better example
--** This is a modification of ex01.exw in win32lib package
without warning
include win32lib.ew
constant SimpleWin = create( Window, "Simple Window", 0, 0, 0, 200,
100, 0 ),
menu = create(Menu,"File",SimpleWin,0,0,0,0,0),
menu1 = create(MenuItem,"New",menu,0,0,0,0,0),
menu2 = create(MenuItem,"Old",menu,0,0,0,0,0)
constant zCheckMenuRadioItem =
registerw32Function(user32,"CheckMenuRadioItem",{C_LONG, C_UINT, C_UINT,
C_UINT, C_UINT}, C_USHORT),
MFT_RADIOCHECK = 512,
MFS_CHECKED = 8
procedure setMenuRadio(integer start,integer last,integer current)
atom retval,mask
mask = or_all({MFS_CHECKED,MFT_RADIOCHECK})
retval =
w32Func(zCheckMenuRadioItem,{getHandle(current),start,last,current,mask})
end procedure
constant
zSetMenuItemInfo=registerw32Function(user32,"SetMenuItemInfoA",{C_LONG,
C_UINT, C_SHORT, C_POINTER}, C_USHORT)
global procedure setMenuBitmap(integer item,object bit1)
integer bool
atom MENUITEMINFO
MENUITEMINFO = acquire_mem(0,48)
mem_set(MENUITEMINFO,0,48)
if sequence(bit1) then
bit1 = loadBitmapFromFile(bit1)
end if
poke4(MENUITEMINFO+0,48)
poke4(MENUITEMINFO+4,#80) --MIIM_BITMAP
poke4(MENUITEMINFO+44,bit1)
bool = w32Func(zSetMenuItemInfo,{getHandle(item),item,0,MENUITEMINFO})
bool = w32Func(xDrawMenuBar,{getHandle(item)})
release_mem(MENUITEMINFO)
end procedure
setMenuRadio(menu1,menu2,menu1)
setMenuBitmap(menu2,"c:\\full\\conn1.bmp")
procedure w32HClick_menu1(integer self,integer event,sequence params)
setMenuRadio(menu1,menu2,menu1)
end procedure
setHandler(menu1,w32HClick,routine_id("w32HClick_menu1"))
procedure w32HClick_menu2(integer self,integer event,sequence params)
setMenuRadio(menu1,menu2,menu2)
end procedure
setHandler(menu2,w32HClick,routine_id("w32HClick_menu2"))
WinMain( SimpleWin, Normal)
|
Not Categorized, Please Help
|
|