首页
社区
课程
招聘
[求助]郁闷的事情,用GetWindowText获取记事本中的文字竟然会失败!
发表于: 2009-1-29 18:21 5743

[求助]郁闷的事情,用GetWindowText获取记事本中的文字竟然会失败!

2009-1-29 18:21
5743
GetWindowText获取记事本中的文字竟然会失败 ,请大家看一下,句柄我使用的是SPY++得到的,用的是硬编码。

.386
.model flat, stdcall
option casemap :none

include windows.inc
include user32.inc
include kernel32.inc
include masm32.inc

includelib user32.lib
includelib kernel32.lib
includelib masm32.lib

.data

buff db 256 dup(0)

.code
start:

invoke GetWindowText,80888h,addr buff,256  ;对记事本的EDIT控件使用会返回0

invoke MessageBox,0,addr buff,0,0

invoke ExitProcess,0

end start

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (4)
雪    币: 307
活跃值: (131)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
2
请看一下MSDN, GetWindowText 不能得到其他进程创建的窗口的文字(除了标题).可以使用WM_GETTEXT

原文:
If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control. If the target window is owned by another process and has a caption, GetWindowText retrieves the window caption text. If the window does not have a caption, the return value is a null string. This behavior is by design. It allows applications to call GetWindowText without hanging if the process that owns the target window is hung. However, if the target window is hung and it belongs to the calling application, GetWindowText will hang the calling application.

To retrieve the text of a control in another process, send a WM_GETTEXT message directly instead of calling GetWindowText.
2009-1-29 18:38
0
雪    币: 152
活跃值: (15)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
SendMessage()
2009-1-29 18:47
0
雪    币: 272
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
然也,万分感谢
2009-1-29 19:02
0
雪    币: 247
活跃值: (11)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
spy++是注入到进程里获取的把。。。。
2009-1-30 11:34
0
游客
登录 | 注册 方可回帖
返回
//