设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1851|回复: 5
打印 上一主题 下一主题

[Access本身] 如何获得控件的句柄

[复制链接]
跳转到指定楼层
1#
发表于 2004-12-21 21:24:00 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式
在VB中每个控件都有HWND属性来获得其句柄。但在Access中却没有这一属性(只有窗体及报表有Hwnd属性),请问大侠如何在Access获得控件的句柄?





答:Private Declare Function apiGetFocus Lib "user32" _

        Alias "GetFocus" _

         () As Long

         

Function fhWnd(ctl As Control) As Long

    On Error Resume Next

    ctl.SetFocus

    If Err Then

        fhWnd = 0

    Else

        fhWnd = apiGetFocus

    End If

    On Error GoTo 0

End Function

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
 楼主| 发表于 2004-12-21 23:46:00 | 显示全部楼层
非常感谢zhengjialon你再一次帮助,但下面这句英文看了半天没有能理解,希望大哥再解释一下   When an Access control on a form receives the focus, it becomes a true window and it's possible to retrieve it's handle by using the GetFocus API.   Note that because Access controls do not behave like VB controls, there's not a whole lot that we can do with the hWnd.
3#
 楼主| 发表于 2004-12-23 06:53:00 | 显示全部楼层
非常感谢方漠,完全正确,我认为也是这样的意思

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-6-2 18:26 , Processed in 0.090604 second(s), 26 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表