[英]How can I determine whether a window from another application is visible?
I recently obtained a license for WinX DVD Ripper Platinum, and am annoyed by the fact that, when it's done ripping a DVD, it doesn't tell me so. 我最近获得了WinX DVD Ripper Platinum的许可证,我很恼火的是,当它翻录DVD时,它并没有告诉我。 There's no popup, no system "beep"- nothing.
没有弹出窗口,没有系统“嘟嘟” - 没什么。 The progress dialog simply closes.
进度对话框只是关闭。 The main window doesn't even focus itself...
主窗口甚至不会集中注意力......
To speed up my DVD-ripping proccess, I'm making a simple console application (using C# and VS2010) that: 为了加快我的DVD翻录过程,我正在制作一个简单的控制台应用程序(使用C#和VS2010):
GetChildWindows
method defined in this sample at pinvoke.net GetChildWindows
方法查找该进程上的进度对话框的句柄 System.Timers.Timer
instance that checks (or is supposed to check) whether the progress dialog has closed every 5 seconds (using the GetWindowLong
function , and System.Timers.Timer
实例,该实例检查(或应该检查)进度对话框是否每5秒关闭一次(使用GetWindowLong
函数 ,以及 System.Console.Beep
method to tell the user that the rip is complete. System.Console.Beep
方法发出一些哔声,告诉用户rip已完成。 The timer auto-resets, performing the check (or repeating the beep if the dialog has closed) every 5 seconds until the user presses a key in the console window. Steps 1, 2, and 4 are working fine, but I'm having problems with step 3- this, my question is, which of the window style constants should I use to check if the window is visible? 第1步,第2步和第4步工作正常,但我遇到第3步的问题,我的问题是,我应该使用哪种窗口样式常量来检查窗口是否可见? (WS_VISIBLE did NOT work...)
(WS_VISIBLE没有工作......)
For more details, this is the function I'm using to check the dialog's visibility: 有关更多详细信息,这是我用来检查对话框可见性的函数:
private static bool IsWindowVisible(IntPtr hwnd)
{
var style = GetWindowLong(hwnd, GWL.GWL_EXSTYLE);
var visible = style & (WS flag goes here);
return visible != 0;
}
您是否尝试过使用IsWindowVisible() ?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.