vb怎么在窗体的标题栏上创建右键菜单?
1个回答
展开全部
Private Sub Form_Load()
OldWindowProc = GetWindowLong(Form1.hwnd, GWL_WNDPROC)
' 取得窗口函数的地址
'Call SetWindowLong(Form1.hwnd, GWL_WNDPROC, AddressOf SubClass1_WndMessage)
' 用SubClass1_WndMessage代替窗口函数处理消息
SysMenuHwnd = GetSystemMenu(Form1.hwnd, False)
Dim hSubMenu As Long
Dim hPopMenuTmp As Long
hSubMenu = SysMenuHwnd
hPopMenuTmp = CreatePopupMenu()
AppendMenu1 hPopMenuTmp, MF_STRING, 2001, "001"
AppendMenu1 hPopMenuTmp, MF_STRING, 2002, "002"
AppendMenu1 hPopMenuTmp, MF_STRING, 2003, "003"
AppendMenu1 hPopMenuTmp, MF_STRING, 2004, "004"
AppendMenu1 hPopMenuTmp, MF_STRING, 2005, "005"
AppendMenu1 hPopMenuTmp, MF_STRING, 2006, "006"
AppendMenu1 hPopMenuTmp, MF_STRING, 2007, "007"
AppendMenu1 hSubMenu, MF_POPUP, hPopMenuTmp, "更换皮肤"
SetMenu Me.hwnd, hMenu
DrawMenuBar Me.hwnd
Me.Refresh
OldWinProc = SetWindowLong(Me.hwnd, GWL_WNDPROC, AddressOf SubClass1_WndMessage)
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询