回复 3楼 eepcvfp
GetSystemMenu()可能有点老了,可能从Win7起就有点不一样,现在Win10测试,要<Shift+右键>才见到老模样,看来要对新模样学习一下。
添加系统菜单项目示例,在窗口标题菜单或任务栏图标<Shift+右键>操作。
程序代码:
DECLARE LONG GetSystemMenu IN User32 LONG, LONG
DECLARE LONG AppendMenu IN User32 LONG, LONG, LONG, STRING@
DECLARE LONG SendMessage IN User32 LONG, LONG, LONG, LONG
_screen.Visible = .F.
of = CREATEOBJECT("TForm")
of.Show
READ EVENTS
RETURN
DEFINE CLASS TForm AS Form
ShowWindow = 2
PROCEDURE Init
*WM_SYSCOMMAND equ 112h
BINDEVENT(this.hWnd, 0x0112, this, "MyMenuCmd1")
AppendMenu(GetSystemMenu(this.hWnd, 0), 0, 0x401, "我的菜单项目")
ENDPROC
PROCEDURE UnLoad
CLEAR EVENTS
ENDPROC
PROCEDURE MyMenuCmd1(hWnd, Msg, wParam, lParam)
IF wParam == 0x401 && 自定义菜单项目消息
MESSAGEBOX("点击了我的菜单项目")
ENDIF
SendMessage(hWnd, Msg, wParam, lParam)
ENDPROC
ENDDEFINE