怎么获得窗口类名称?

xiaowenwen 2005-08-08 11:50:33
我想向“计算器”的文本框发送消息,但是需要知道计算器窗口类的名称,怎么获得呢?
谢谢!
...全文
167 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
VxD1 2005-08-08
  • 打赏
  • 举报
回复
有个程序记不得叫什么,图标是一个戴帽子的人,那个程序能获得程序的句柄和窗口类
pediy.com那里有下载
wqssqw 2005-08-08
  • 打赏
  • 举报
回复
请参考下面的程序:

char *strrlt = "exp...";
HWND hwnd=(HWND)::GetForegroundWindow(); //首先获取窗口句柄
long threadid1 =::GetWindowThreadProcessId(hwnd,0);
long threadid0 =::GetCurrentThreadId();
::AttachThreadInput(threadid0,threadid1,TRUE); //连接线程
HWND hwnd1 = (HWND)::GetFocus();
::SendMessage(hwnd1,EM_REPLACESEL,(long)strrlt,0);
::AttachThreadInput(threadid0,threadid1,FALSE);

这种方法一定成功,上次我是无意中发现的
大熊猫侯佩 2005-08-08
  • 打赏
  • 举报
回复
.386
.model flat,stdcall
option casemap :none

include i:\masm32\include\windows.inc
include i:\masm32\include\user32.inc
include i:\masm32\include\kernel32.inc
includelib i:\masm32\lib\user32.lib
includelib i:\masm32\lib\kernel32.lib

.data
hedit dd 0A025Ch ;get the edit handle

.data?

.code
start:
xor eax,eax
mov al,'9'
invoke PostMessage,hedit,WM_CHAR,eax,1

invoke ExitProcess,NULL

end start
大熊猫侯佩 2005-08-08
  • 打赏
  • 举报
回复
向“计算器”的文本框发送消息,但是需要知道计算器窗口类的名称
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
取得控键句柄就可以了吧。
大熊猫侯佩 2005-08-08
  • 打赏
  • 举报
回复
可以使用:WindowFromPoint

;A KIMDS CODE

.386
.model flat,stdcall
option casemap :none

include i:\masm32\include\windows.inc
include i:\masm32\include\user32.inc
include i:\masm32\include\kernel32.inc
includelib i:\masm32\lib\user32.lib
includelib i:\masm32\lib\kernel32.lib

.const
szcp db 'windows2003',0
szerror db 'GetCurrsorPos 失败!',0
sztext db 'x: %d ,y: %d is %d',0
sznull db '该位置没有控件存在!',0

.data?
hInstance dd ?
xp dd ?
yp dd ?
xy POINT <>
szbuffer db 256 dup (?)

.code
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
.while 1
invoke GetCursorPos,addr xy
.if eax==0
invoke MessageBox,NULL,offset szerror,offset szcp,MB_OK
invoke ExitProcess,NULL
.endif
invoke WindowFromPoint,xy.x,xy.y
.if eax==0
invoke MessageBox,NULL,offset sznull,offset szcp,MB_OK
.elseif
invoke wsprintf,addr szbuffer,addr sztext,xy.x,xy.y,eax
invoke MessageBox,NULL,offset szbuffer,offset szcp,MB_OK
.endif

.endw

end start
xiaowenwen 2005-08-08
  • 打赏
  • 举报
回复
请问楼上大哥具体调用哪个API呢?
大熊猫侯佩 2005-08-08
  • 打赏
  • 举报
回复
1 用专用的工具比如 VC++6.0 自带的 spy++

2 编程实现,通过调用 api 实现取得目标窗体上特定坐标的控件句柄来完成。

21,458

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧