1

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. 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:

  1. Finds the handle of the process named "WinX_DVD_Ripper_Platinum" (the process name of the WinX DVD Ripper Platinum software)
  2. Finds the handle of the progress dialog on that process using the GetChildWindows method defined in this sample at pinvoke.net
  3. Starts a 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
  4. Plays a few beeps with the System.Console.Beep method to tell the user that the rip is complete. 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? (WS_VISIBLE did NOT work...)

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;
}
0

1 Answer 1

4

Have you tried using IsWindowVisible() instead?

2
  • Wow, I feel stupid... :) Thanks for the quick and simple answer. I think I've googled variations of "pinvoke window visible" about 50 times in the last 2 days and somehow never seen that function. Thanks, Lambert. Jan 4, 2011 at 0:47
  • 2
    Glad it helped! :) (Edit: By the way, from experience: never google "pinvoke" unless you want articles on using DllImport!)
    – user541686
    Jan 4, 2011 at 0:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.