首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

怎么获取图片框中标签的文本内容

2012-01-21 
如何获取图片框中标签的文本内容在一个图片框中加入一个标签,使用SPY++不能够获取标签的句柄,我该怎样获取

如何获取图片框中标签的文本内容
在一个图片框中加入一个标签,使用SPY++不能够获取标签的句柄,我该怎样获取标签的文本内容?

[解决办法]
这个是API绘制上去的。。。

复杂了。要用apihook技术了
[解决办法]
你指的标签是VB Label?它没有句柄。
[解决办法]
如果是用API汇上去的,就有可能得到它。
for a API created Label:
Class: Static
Style: WS_CHILD WS_VISIBLE
Parent:
Parent Text:
Parent Class: SysHeader32



[解决办法]
' Get cursor position
GetCursorPos tPA
' Get window handle from point
lhWnd = WindowFromPoint(tPA.X, tPA.Y)
' Get window caption
lRetVal = GetWindowText(lhWnd, sTitle, 255)
' Get window class name
lRetVal = GetClassName(lhWnd, sClass, 255)
' Get window style
sStyle = GetWindowStyle(lhWnd)
' Get window rect
GetWindowRect lhWnd, tRC
' Get window parent
lhWndParent = GetParent(lhWnd)
' Get parent window caption
lRetVal = GetWindowText(lhWndParent, sParentTitle, 255)
' Get parent window class name
lRetVal = GetClassName(lhWndParent, sParentClass, 255)


[解决办法]
两种思路:
1 文字识别
2 从程序对应的内存数据入手

不管用什么方法实现起来都不简单
[解决办法]
图片框成为标签控件的父容器了,到这个图片框中找它所包含的子控件就行了。

这种敏感问题总让人想到非法用途,希望楼主不是那种人。

热点排行