如何得到窗口的类型?

longji 2004-04-16 05:23:35
1、windows编程中的窗口共有多少种类型,在那里可以查到各种类型的属性
2、如果得到一个进程的所以窗口类型。()其实只要能得到一个类型就可以了,我可以自己举出其它类型。
3、可以给出方法,函数、或者相关资料的网址
...全文
166 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
longji 2004-04-16
  • 打赏
  • 举报
回复
谢谢各位大侠,我的E文不好,所以很多MSDN上的都看不懂,不过,看了上面的总算有点头绪了。
还有,有这种方法可以得到这个窗体中的所有控件吗?比如:编辑框或按钮之类的。
我想做一个可以查找本窗口所有组成控件的函数,不知道现不现实?
正在实验中。希望各位继续支持!
itmaster 2004-04-16
  • 打赏
  • 举报
回复
枚举窗口相信大家都用过了,但是都会碰到同样一个问题,就是调用EnumWindow或者EnumChildWindow或者之类的方法的时候,枚举出来的窗口是所有的桌面窗口,往往一般我们只需要我们打开的应用程序的窗口,也就是任务栏上显示的窗口,试了一下,用下面的方法类似的可以得到任务栏的窗口。

BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
if(IsWindowVisible(hwnd) &&
((GetWindowLong(hwnd, GWL_EXSTYLE)&WS_EX_TOOLWINDOW)!=WS_EX_TOOLWINDOW) &&
(GetWindowLong(hwnd, GWL_HWNDPARENT)==0))
g_dwWndList.Add((DWORD)hwnd);
return TRUE;
}

g_dwWndList是一个全局的CDWordArray的变量保存枚举出来的窗口。
这种方法可以稍加改变就可以找出你想找的具有特定类型的窗口。
byf2002 2004-04-16
  • 打赏
  • 举报
回复
Extended Window Styles
WS_EX_ACCEPTFILES Specifies that a window created with this style accepts drag-and-drop files.


WS_EX_CLIENTEDGE Specifies that a window has a 3D look — that is, a border with a sunken edge.


WS_EX_CONTEXTHELP Includes a question mark in the title bar of the window. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message.


WS_EX_CONTROLPARENT Allows the user to navigate among the child windows of the window by using the TAB key.


WS_EX_DLGMODALFRAME Designates a window with a double border that may (optionally) be created with a title bar when you specify the WS_CAPTION style flag in the dwStyle parameter.


WS_EX_LEFT Gives window generic left-aligned properties. This is the default.


WS_EX_LEFTSCROLLBAR Places a vertical scroll bar to the left of the client area.


WS_EX_LTRREADING Displays the window text using left-to-right reading order properties. This is the default.


WS_EX_MDICHILD Creates an MDI child window.


WS_EX_NOPARENTNOTIFY Specifies that a child window created with this style will not send the WM_PARENTNOTIFY message to its parent window when the child window is created or destroyed.


WS_EX_OVERLAPPEDWINDOW Combines the WS_EX_CLIENTEDGE and WS_EX_WINDOWEDGE styles


WS_EX_PALETTEWINDOW Combines the WS_EX_WINDOWEDGE and WS_EX_TOPMOST styles.


WS_EX_RIGHT Gives a window generic right-aligned properties. This depends on the window class.


WS_EX_RIGHTSCROLLBAR Places a vertical scroll bar (if present) to the right of the client area. This is the default.


WS_EX_RTLREADING Displays the window text using right-to-left reading order properties.


WS_EX_STATICEDGE Creates a window with a three-dimensional border style intended to be used for items that do not accept user input.


WS_EX_TOOLWINDOW Creates a tool window, which is a window intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the task bar or in the window that appears when the user presses ALT+TAB.


WS_EX_TOPMOST Specifies that a window created with this style should be placed above all nontopmost windows and stay above them even when the window is deactivated. An application can use the SetWindowPos member function to add or remove this attribute.


WS_EX_TRANSPARENT Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated.


WS_EX_WINDOWEDGE Specifies that a window has a border with a raised edge.
byf2002 2004-04-16
  • 打赏
  • 举报
回复
Window Styles
WS_BORDER Creates a window that has a border.


WS_CAPTION Creates a window that has a title bar (implies the WS_BORDER style). Cannot be used with the WS_DLGFRAME style.


WS_CHILD Creates a child window. Cannot be used with the WS_POPUP style.


WS_CLIPCHILDREN Excludes the area occupied by child windows when you draw within the parent window. Used when you create the parent window.


WS_CLIPSIBLINGS Clips child windows relative to each other; that is, when a particular child window receives a paint message, the WS_CLIPSIBLINGS style clips all other overlapped child windows out of the region of the child window to be updated. (If WS_CLIPSIBLINGS is not given and child windows overlap, when you draw within the client area of a child window, it is possible to draw within the client area of a neighboring child window.) For use with the WS_CHILD style only.


WS_DISABLED Creates a window that is initially disabled.


WS_DLGFRAME Creates a window with a double border but no title.


WS_GROUP Specifies the first control of a group of controls in which the user can move from one control to the next with the arrow keys. All controls defined with the WS_GROUP style FALSE after the first control belong to the same group. The next control with the WS_GROUP style starts the next group (that is, one group ends where the next begins).


WS_HSCROLL Creates a window that has a horizontal scroll bar.


WS_MAXIMIZE Creates a window of maximum size.


WS_MAXIMIZEBOX Creates a window that has a Maximize button.


WS_MINIMIZE Creates a window that is initially minimized. For use with the WS_OVERLAPPED style only.


WS_MINIMIZEBOX Creates a window that has a Minimize button.


WS_OVERLAPPED Creates an overlapped window. An overlapped window usually has a caption and a border.


WS_OVERLAPPEDWINDOW Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles.


WS_POPUP Creates a pop-up window. Cannot be used with the WS_CHILD style.


WS_POPUPWINDOW Creates a pop-up window with the WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION style must be combined with the WS_POPUPWINDOW style to make the Control menu visible.


WS_SYSMENU Creates a window that has a Control-menu box in its title bar. Used only for windows with title bars.


WS_TABSTOP Specifies one of any number of controls through which the user can move by using the TAB key. The TAB key moves the user to the next control specified by the WS_TABSTOP style.


WS_THICKFRAME Creates a window with a thick frame that can be used to size the window.


WS_VISIBLE Creates a window that is initially visible.


WS_VSCROLL Creates a window that has a vertical scroll bar.
vcforever 2004-04-16
  • 打赏
  • 举报
回复
1、很多,具体没树过,你可以在MSDN中查到各种窗口的风格
2、使用EnumWindow和EnumChildWindow来枚举窗口,
3、使用GetWindowLong来获得窗口的风格
leew 2004-04-16
  • 打赏
  • 举报
回复
GetWindowInfo()
vollin 2004-04-16
  • 打赏
  • 举报
回复
GetWindowLong()

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

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