If all you want to do is detecting when a certain window of another program has been made visible then its almost sure that you shouldn't install global hooks and other fancy stuff. I would write a program that runs in the background and periodically checks (for example every half seconds) if the window has become visible or not and you play a sound when this condition changes from false into true. So your program should look like this:
bool currently_visible = false;
for (;;)
{
bool visible = IsThatWindowVisible();
if (!currently_visible && visible)
PlayNotificationSound();
currently_visible = visible;
if (exit_requested)
break;
Sleep_half_second();
}
All you h have to write besides this is a function:
bool IsThatWindowVisible()
. If you can identify the window by its titlebar text or by its window class (you can find out the windowclass with the spy++ program) that is the best because then you can use
FindWindow()[
^] to check if the window exists and when you have the HWND to that window you can do additional checking on the window (for example if it is visible, if it has a certain value in one of its editboxes/labels - you can find out which is the control id of its child controls with spy++).
If you can not detect the window by its titlebar or window class then you have to use
EnumWindows()[
^] to iterate over all windows and check all HWNDs to find out if its the right HWND or not (for example by checking if its have a child control with control_id==XXX and window_text=="blahblah" and window_class=="Button").