Icon Clean?

This is a discussion on Icon Clean? within the Windows Programming forums, part of the Platform Specific Boards category; When I use killtask() or terminate a prog there is an icon by the clock on the start bar. The ...

  1. #1
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638

    Icon Clean?

    When I use killtask() or terminate a prog there is an icon by the clock on the start bar. The prog icon while the prog is running then terminates exits but the other icon to the right by the clock does not. Is there a way to clean that or remove it?

    Remove all non running prog icons or process icons?

    Thank you in advance.

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    You can do this by running the mouse cursor over the dead icon. I found a function that does this from my KillProcess utility.
    Code:
    void refreshTray() {
    
    	HWND hTaskbar, hNotify, hTray;
    	RECT rc;
    	int xPos, yPos;
    
    	// Obtain task tray window handle by drilling down
    	hTaskbar = FindWindow(TEXT("Shell_TrayWnd"), NULL);
    	hNotify = FindWindowEx(hTaskbar, NULL, TEXT("TrayNotifyWnd"), NULL);
    	hTray = FindWindowEx(hNotify, NULL, TEXT("ToolbarWindow32"), NULL);
    
    	if (hTray == NULL || GetClientRect( hTray, &rc ) == 0) return;
    
    	// Simulate mouse moving along task icons
    	// This will kill dead icons
    	for (yPos = 0;yPos < rc.bottom; yPos += 4) {
    
    		for (xPos = 0;xPos < rc.right; xPos += 4) {
    			PostMessage( hTray, WM_MOUSEMOVE, 0,  MAKELONG(xPos, yPos) );
    		}
    	}
    }

  3. #3
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    i was doing that by paw. i was hopeing that there was a beter way than to position the cursor over the icon. by paw or proggie. thought there might be a deleteicon() function that i missed. or just messed up the proggie.

    thank you again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Icon Help
    By The Brain in forum Windows Programming
    Replies: 11
    Last Post: 04-05-2009, 05:06 PM
  2. icon not showing
    By xlnk in forum Windows Programming
    Replies: 2
    Last Post: 02-27-2004, 06:36 PM
  3. Icon problem
    By mkyong in forum Windows Programming
    Replies: 0
    Last Post: 02-17-2003, 05:39 PM
  4. Icon? help!
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-16-2001, 06:21 PM
  5. icon in title bar?
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 12-12-2001, 06:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21