Re: Trying to close a bubble window that pops up from a tray icon
Quote:
Originally Posted by
DeepT
Peter_b: EnumChildWindows, sorry about that.
Just to make sure you've covered all bases, have you tried it with just EnumWindows? I.e.
Code:
CString Output;
BOOL CALLBACK EnumFunc(HWND hwnd, LPARAM lParam)
{
// Get text and add to 'Output' etc...
return TRUE;
}
void WaitForClick(void)
{
bool DidClick = false;
while ( false == DidClick)
{
printf(" ------------ \n");
EnumWindows( EnumFunc, (LPARAM)&DidClick);
Sleep(500);
printf(" ------- \n");
}
}
Re: Trying to close a bubble window that pops up from a tray icon
Enum windows only does top level windows, not their children. I have tried it, and it does indeed return less results than EnumChildWindows.
There has to be a way to do this. I have no idea why this pop-up window is special, although I am not getting any other popup windows either.
I tried to find the processes, but when I click on the processID in spy, spy crashes.
Re: Trying to close a bubble window that pops up from a tray icon
Quote:
Originally Posted by
DeepT
... when you select it using the find window where you drag the icon, it says it's parent is the shell tray or the "Shell_TrayWnd" class.
So, find the Shell_TrayWnd window and enum its childen!
Re: Trying to close a bubble window that pops up from a tray icon
I did, and guess what? NADA. Didn't find it. I think tool-tip windows are special and do not show up.
Re: Trying to close a bubble window that pops up from a tray icon
Quote:
Originally Posted by
DeepT
I did, and guess what? NADA. Didn't find it. I think tool-tip windows are special and do not show up.
What did you do?
Have you found the Shell_TrayWnd window?
Have you enumerate its children?
Re: Trying to close a bubble window that pops up from a tray icon
I figured out the general solution, I do not know why this works when enum windows does not, however here it is:
Code:
#define SEARCH_TEXT_XP2000 "Click here to enter your user name and password for the network"
#define SEARCH_TEXT_VISTA "Click to provide additional information and connect"
void WaitForClick(void)
{
bool Loop = true;
char Buffer[1025];
Buffer[0] = 0;
while ( Loop )
{
HWND h1 = NULL, h2 = NULL;
h1 = FindWindowEx(NULL, h2, "tooltips_class32", NULL);
while ( h1 != NULL )
{
int Len;
Len = (int)SendMessage(h1, WM_GETTEXT, 1024, (LPARAM)Buffer);
CString MatchBuff;
MatchBuff = Buffer;
if ( Len > 2 )
{
if ( (-1 != MatchBuff.Find(SEARCH_TEXT_XP2000)) || (-1 != MatchBuff.Find(SEARCH_TEXT_VISTA)) )
{
// CloseWindow( h1 );
// SendMessage( h1, WM_CLOSE, NULL, NULL );
ShowWindow( h1, SW_HIDE );
Loop = false;
break;
}
}
h2 = h1;
h1 = FindWindowEx(NULL, h2, "tooltips_class32", NULL);
}
}
}
The only side effect of this is that the CloseWindow seems to cause the tool-tip window to become corrupt. When it pops the window up the next time (by going through the steps to get it to show naturally on its own) the window is all the wrong size and looks like a simple, short text box. The SendMessage() with WM_CLOSE seems to have made the window disappear all together and I may need to reboot to get it to show up again.
Once I get it back, Ill try SW_HIDE and maybe that will be gentler and just make it go away without corrupting it. Doesn't clicking on the close gadget in a window send the WM_CLOSE message?
Anyway this is resolved and thanks for all your help.