CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    Join Date
    Jan 2009
    Posts
    596

    Re: Trying to close a bubble window that pops up from a tray icon

    Quote Originally Posted by DeepT View Post
    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");
    	}  
    }

  2. #17
    Join Date
    Sep 2004
    Posts
    1,361

    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.

  3. #18
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Trying to close a bubble window that pops up from a tray icon

    Quote Originally Posted by DeepT View Post
    ... 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!
    Victor Nijegorodov

  4. #19
    Join Date
    Sep 2004
    Posts
    1,361

    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.

  5. #20
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Trying to close a bubble window that pops up from a tray icon

    Quote Originally Posted by DeepT View Post
    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?
    Victor Nijegorodov

  6. #21
    Join Date
    Sep 2004
    Posts
    1,361

    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.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured