首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

怎么遍历切换窗口

2012-02-24 
如何遍历切换窗口如何遍历本工程Project1.exe中所有的已打开窗口,包括动态创建的窗口。并且把窗口标题动态

如何遍历切换窗口
如何遍历本工程Project1.exe中所有的已打开窗口,包括动态创建的窗口。并且把窗口标题动态显示在一个菜单中。当点击相关标题的菜单项时,切换显示这个窗口?类似于 Window 这样的菜单设置。

[解决办法]
遍历http://blog.csdn.net/wh445306/archive/2007/12/18/1950812.aspx
遍历窗口,得到句柄,然后SetForegroundWindow
[解决办法]
With this change, an application cannot force a window to the foreground while the user is working with another window. Instead, Foreground and Background Windows will activate the window (see SetActiveWindow) and call the function to notify the user. However, on Microsoft® Windows® 98 and Windows Millennium Edition (Windows Me), if a nonforeground thread calls SetForegroundWindow and passes the handle of a window that was not created by the calling thread, the window is not flashed on the taskbar. To have SetForegroundWindow behave the same as it did on Windows 95 and Microsoft Windows NT® 4.0, change the foreground lock timeout value when the application is installed. This can be done from the setup or installation application with the following function call:

SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID)0, SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE); 

This method allows SetForegroundWindow on Windows 98/Windows Me and Windows 2000/Windows XP to behave the same as Windows 95 and Windows NT 4.0, respectively, for all applications. The setup application should warn the user that this is being done so that the user isn 't surprised by the changed behavior. On Windows Windows 2000 and Windows XP, the call fails unless the calling thread can change the foreground window, so this must be called from a setup or patch application. For more information, see Foreground and Background Windows.

热点排行