-
-
[求助]关于EM_FINDTEXT紧急求助
-
发表于: 2010-3-10 10:30 3221
-
先打开记事本,里面什么也不写,运行下面代码
findtext应该找不到东西,所有应该返回-1,可是不管记事本写什么,都是返回0,不知道为什么
别的消息可以正常返回如选择,写入文本等
源码如下:
.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib
.data
sz1 db "hello!",0
sz2 db "找到了",0
sz3 db "没找到",0
szClass db "notepad",0
hWin dd ?
.code
main proc
LOCAL @stFind:FINDTEXT
invoke FindWindow,offset szClass,NULL
mov hWin,eax
invoke ChildWindowFromPoint,hWin,20,20
mov hWin,eax
mov @stFind.chrg.cpMin,0
mov @stFind.chrg.cpMax,-1
mov @stFind.lpstrText,offset sz1
invoke SendMessage,hWin,EM_SETSEL,0,-1
invoke SendMessage,hWin,EM_FINDTEXT,FR_DOWN,addr @stFind
.if eax!=-1
invoke MessageBox,NULL,offset sz2,offset sz2,MB_OK
.else
invoke MessageBox,NULL,offset sz3,offset sz3,MB_OK
.endif
ret
main endp
start:
call main
invoke ExitProcess,NULL
end start
findtext应该找不到东西,所有应该返回-1,可是不管记事本写什么,都是返回0,不知道为什么
别的消息可以正常返回如选择,写入文本等
源码如下:
.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib
.data
sz1 db "hello!",0
sz2 db "找到了",0
sz3 db "没找到",0
szClass db "notepad",0
hWin dd ?
.code
main proc
LOCAL @stFind:FINDTEXT
invoke FindWindow,offset szClass,NULL
mov hWin,eax
invoke ChildWindowFromPoint,hWin,20,20
mov hWin,eax
mov @stFind.chrg.cpMin,0
mov @stFind.chrg.cpMax,-1
mov @stFind.lpstrText,offset sz1
invoke SendMessage,hWin,EM_SETSEL,0,-1
invoke SendMessage,hWin,EM_FINDTEXT,FR_DOWN,addr @stFind
.if eax!=-1
invoke MessageBox,NULL,offset sz2,offset sz2,MB_OK
.else
invoke MessageBox,NULL,offset sz3,offset sz3,MB_OK
.endif
ret
main endp
start:
call main
invoke ExitProcess,NULL
end start
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
赞赏
他的文章
- 鼠标键盘记录回放 钩子 6852
- [求助]api函数URLDownloadToFile使用中出现问题 6061
- [求助]使用URLDownloadToFile函数出现问题了 5943
- 网页文件打包成exe电子书的工作原理 3979
- 汇编编程不能正确运行 4434
赞赏
雪币:
留言: