判断组合框是否处于下拉状态
时 间:2007-12-18 08:46:51
作 者:Dev Ashish ID:8 城市:上海 QQ:2851379730
摘 要:判断组合框是否处于下拉状态
正 文:
'******* Code Start *********
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
' retrieves the name of the class to which the specified window belongs.
Private Declare Function apiGetClassName Lib "user32" _
Alias "GetClassNameA" _
(ByVal hwnd As Long, _
ByVal lpClassname As String, _
ByVal nMaxCount As Long) _
As Long
' retrieves a handle to the specified child window's parent window.
Private Declare Function apiGetParent Lib "user32" _
Alias "GetParent" _
(ByVal hwnd As Long) _
As Long
' retrieves information about the specified window. The function also
' retrieves the 32-bit (long) value at the specified offset into the
' extra window memory of a window.
Private Declare Function apiGetWindowLong Lib "user32" _
Alias "GetWindowLongA" _
(ByVal hwnd As Long, _
ByVal nIndex As Long) _
As Long
' retrieves a handle to the top-level window whose class name and
' window name match the specified strings. This function does not search
' child windows. This function does not perform a case-sensitive search.
Private Declare Function apiFindWindow Lib "user32" _
Alias "FindWindowA" _
(ByVal lpClassname As String, _
ByVal lpWindowName As String) _
As Long
' retrieves a handle to a window that has the specified relationship
' (Z order or owner) to the specified window
Private Declare Function apiGetWindow Lib "user32" _
Alias "GetWindow" _
(ByVal hwnd As Long, _
ByVal wCmd As Long) _
As Long
' The class name for an Access combo's drop down listbox window
Private Const ACC_CBX_LISTBOX_CLASS = "OGrid"
' Class name for the Access window
Private Const ACC_MAIN_CLASS = "OMain"
' Class name for an Access combo's drop down listbox's parent window
Private Const ACC_CBX_LISTBOX_PARENT_CLASS = "ODCombo"
' class name for an Access form's client window
Private Const ACC_FORM_CLIENT_CLASS = "OFormSub"
' class name for Edit controls in Access
Private Const ACC_CBX_EDIT_CLASS = "OKttbx"
' class name for VB combo's drop down listbox's parent window (SDI)
Private Const VB_CBX_LISTBOX_PARENT_CLASS = "#32769" ' // Desktop
' class name for VB combo's drop down listbox window
Private Const VB_CBX_LISTBOX_CLASS = "ComboLBox"
' handle identifies the child window at the top of the Z order,
' if the specified window is a parent window
Private Const GW_CHILD = 5
' Retrieves the window styles.
Private Const GWL_STYLE = (-16)
' flag denoting that a window is visible
Private Const WS_VISIBLE = &H10000000
Function fIsComboOpen() As Boolean
' returns true if a combo box on the form is dropped down
' only one combo can have the focus => only one drop down
'
Static hwnd As Long
Static hWndCBX_LBX As Long
hwnd = 0: hWndCBX_LBX = 0
' Start with finding the window with "ODCombo" class name
hwnd = apiFindWindow(ACC_CBX_LISTBOX_PARENT_CLASS, _
vbNullString)
' Parent window of ODCombo is the Access window
If apiGetParent(hwnd) = hWndAccessApp Then
' Child window of ODCombo window is the
' d
Access软件网QQ交流群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- 统计当月之前(不含当月)的记录...(03.11)
- 【Access Inputbo...(03.03)
- 按回车键后光标移动到下一条记录...(02.12)
- 【Access Dsum示例】...(02.07)
- Access对子窗体的数据进行...(02.05)
- 【Access高效办公】上月累...(01.09)
- 【Access高效办公】上月累...(01.06)
- 【Access Inputbo...(12.23)
- 【Access Dsum示例】...(12.16)

学习心得
最新文章
- 32位的Access软件转化为64...(04.12)
- 【Access高效办公】如何让vb...(04.11)
- 仓库管理实战课程(10)-入库功能...(04.08)
- Access快速开发平台--Fun...(04.07)
- 仓库管理实战课程(9)-开发往来单...(04.02)
- 仓库管理实战课程(8)-商品信息功...(04.01)
- 仓库管理实战课程(7)-链接表(03.31)
- 仓库管理实战课程(6)-创建查询(03.29)
- 仓库管理实战课程(5)-字段属性(03.27)
- 设备装配出入库管理系统;基于Acc...(03.24)