Win32 API FindWindow& FindWindowEx [英] Win32 API FindWindow & FindWindowEx

查看:499
本文介绍了Win32 API FindWindow& FindWindowEx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在尝试实现FindWindow& FindWindowEx我很惊讶地发现既没有使用窗口的实际名称来返回句柄。 在FindWindow的情况下,搜索的参数是窗口"caption";在
FindWindowEx(搜索TextBox时)的情况下,参数必须是Textbox的内容(TextBox_Name.Text)才能返回它的句柄。



鉴于TextBox的内容是流动的,为什么FindWindowEx使用内容返回句柄而不是实际的TextBox名称?



格式:wHdl = FindWindow(Parent_wHdl," ThunderRT6Textbox"," Some text?")



是否有另一个返回TextB的Win32 API ox(或其他窗口)基于窗口的实际名称而不是标题或内容?



IM

解决方案

Win32 API是在.Net Framework和Windows Forms之前几十年创建的在讨论Windows(包括按钮,编辑控件,静态文本控件等)时,FindWindow和
FindWindowEx搜索中使用的相关特征是目标窗口的标题(即标题)和/或其窗口类。 虽然编辑控件(你称之为文本框)的文本确实根据用户输入而改变,但分配给大多数其他窗口的字幕通常是静态的。


在Win32 API中没有"窗口的实际名称"这样的东西。



顺便说一下,即使这个问题是从Windows窗体论坛移出,"ThunderRT6Textbox"是VB6使用的类名。



$


In trying to implement FindWindow & FindWindowEx I was surprised to discover that neither use the actual name of the window to return the handle.  In the case of FindWindow the parameter searched for is the window "caption"; in the case of FindWindowEx (when searching for a TextBox) the parameter must be the contents (TextBox_Name.Text) of the Textbox to return it's handle.

Given that the contents of a TextBox are fluid, why does FindWindowEx use the contents to return the handle as opposed to the actual TextBox name?

Format: wHdl = FindWindow(Parent_wHdl, "ThunderRT6Textbox", "Some text?")

Is there another Win32 API that returns a TextBox (or other window) based on the actual name of the window not the caption, or contents?

IM

解决方案

The Win32 API was created decades before the .Net Framework and Windows Forms came into existence.  When discussing windows (including  buttons, edit controls, static text controls, etc.)  the relevant characteristics used in FindWindow and FindWindowEx searches are the target window's title (i.e., caption) and/or its window class.  And although the text of an edit control (what you call a Textbox) does change based on user input, the captions assigned to most other windows are often static.

In the Win32 API there is no such thing as the "actual name of the window".

By the way, even though this question was moved from the Windows Forms forum, "ThunderRT6Textbox" is a class name used by VB6.




这篇关于Win32 API FindWindow& FindWindowEx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆