cSmpMenu.cls
资源名称:IE_VB.rar [点击查看]
上传用户:davilee3
上传日期:2015-04-22
资源大小:986k
文件大小:3k
源码类别:
浏览器
开发平台:
Visual Basic
- VERSION 1.0 CLASS
- BEGIN
- MultiUse = -1 'True
- Persistable = 0 'NotPersistable
- DataBindingBehavior = 0 'vbNone
- DataSourceBehavior = 0 'vbNone
- MTSTransactionMode = 0 'NotAnMTSObject
- END
- Attribute VB_Name = "cSmpMenu"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = False
- '---------------------------------------------------------------------------------------
- ' Module : cSmpMenu
- ' DateTime : 2005-4-15 13:21
- ' Author : Lingll
- ' Purpose : 方便处理单个menu item 的冬冬
- '---------------------------------------------------------------------------------------
- Option Explicit
- Private Declare Function EnableMenuItem Lib "user32" (ByVal hMenu As Long, ByVal wIDEnableItem As Long, ByVal wEnable As Long) As Long
- Private Declare Function CheckMenuItem Lib "user32" (ByVal hMenu As Long, ByVal wIDCheckItem As Long, ByVal wCheck As Long) As Long
- Private Declare Function GetMenuState Lib "user32.dll" (ByVal hMenu As Long, ByVal wID As Long, ByVal wFlags As Long) As Long
- Private Const MF_CHECKED = &H8&
- Private Const MF_ENABLED = &H0&
- Private Const MF_GRAYED = &H1&
- Private Const MF_UNCHECKED = &H0&
- Private Const MF_BYCOMMAND = &H0&
- Private Const MF_BYPOSITION = &H400&
- Private mByCommand As Boolean
- Private mHwnd As Long
- Private m_ID As Long
- Public Sub Ini(vHwnd&, vId&, vBycommand As Boolean)
- mHwnd = vHwnd
- m_ID = vId
- mByCommand = vBycommand
- End Sub
- Public Sub ResetId(vId&, vBycommand As Boolean)
- m_ID = vId
- mByCommand = vBycommand
- End Sub
- Public Sub ResetHwnd(vHwnd&)
- mHwnd = vHwnd
- End Sub
- Public Sub EnableItem(vTrue As Boolean)
- Dim tFlag&
- If mByCommand Then
- tFlag = MF_BYCOMMAND
- Else
- tFlag = MF_BYPOSITION
- End If
- If vTrue Then
- tFlag = tFlag Or MF_ENABLED
- Else
- tFlag = tFlag Or MF_GRAYED
- End If
- Call EnableMenuItem(mHwnd, m_ID, tFlag)
- End Sub
- Public Sub CheckItem(vCheck As Boolean)
- Dim tFlag&
- If mByCommand Then
- tFlag = MF_BYCOMMAND
- Else
- tFlag = MF_BYPOSITION
- End If
- If vCheck Then
- tFlag = tFlag Or MF_CHECKED
- Else
- tFlag = tFlag Or MF_UNCHECKED
- End If
- Call CheckMenuItem(mHwnd, m_ID, tFlag)
- End Sub
- '---------------------------------------------------------------------------------------
- ' Procedure : GetCheckState
- ' DateTime : 2005-4-15 13:32
- ' Author : Lingll
- ' Purpose : 获得check state
- '---------------------------------------------------------------------------------------
- Public Function GetCheckState() As Boolean
- Dim tFlag&
- If mByCommand Then
- tFlag = MF_BYCOMMAND
- Else
- tFlag = MF_BYPOSITION
- End If
- GetCheckState = ((GetMenuState(mHwnd, m_ID, tFlag) And MF_CHECKED) <> 0)
- End Function