Thread: Refresh exporer based displays

  1. #1
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158

    Refresh exporer based displays

    When I programmaticly delete a file on the desktop, the image of it remains there until I manually refresh it. Is there an API or something that will cause all explorer-based displays (like the desktop, explorer, open file dialog boxes, etc.) to refresh?

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    Hmm. The FolderView class, which is what Explorer uses, normally opens a directory change notification handle (e.g. FindFirstChangeNotification) for the path that it's looking at, so that the file system driver tells it when something changes.

    Not sure why it wouldn't be tracking your deletion though.

  3. #3
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Well, that happens on a Vista system, so I wouldn't be surprised if that has anything to do with it.
    What ever the cause, I need to manually refresh it somehow.
    Is there a MC WM of some kind I can send the desktop?

  4. #4
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    There is an API to refresh the desktop. I know because we used it in our product once. However it rearranges all your icons as well so users may not like it.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  5. #5
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by iMalc View Post
    There is an API to refresh the desktop. I know because we used it in our product once. However it rearranges all your icons as well so users may not like it.
    but i thougth change was good lol

  6. #6
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    Is there an API or something that will cause all explorer-based displays (like the desktop, explorer, open file dialog boxes, etc.) to refresh?
    Code:
    #pragma comment( lib, "shell32.lib" ) 
    #include <windows.h>
    #include <shlobj.h>
    
    int main(void)
    {
        SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
        return 0;
    }
    If a desktop item is properly deleted using the shell api, the desktop will be automatically updated. So, the issue may be with how you delete the file on the desktop

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. why page based I/O can improve performance?
    By George2 in forum C Programming
    Replies: 1
    Last Post: 06-12-2006, 07:42 AM
  2. Monitor Refresh Rates
    By SlyMaelstrom in forum Tech Board
    Replies: 4
    Last Post: 05-24-2006, 01:08 PM
  3. I Need To Know Some Things That I Can Put Into A Batch File
    By TheRealNapster in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 10-20-2003, 08:12 PM
  4. curses problem
    By rajesh23 in forum Linux Programming
    Replies: 2
    Last Post: 10-07-2003, 07:27 AM
  5. Dos commands hehe
    By Carp in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 01-17-2003, 02:51 PM