Page 1 of 1

PB-deleted file still appears in Windows Explorer

Posted: Fri Oct 21, 2016 3:29 am
by PB2004
From PureBasic, I delete a file but it still appears afterward in Windows Explorer. If I click on it, I get the message "Could not find this item. This is no longer located...." If, in Windows Explorer, I move off the directory and then back in, the file is no longer listed.

Does someone know some trick to fix this ghosting?

Windows 7, PB ver. 5.50 x64

Thanks

Re: PB-deleted file still appears in Windows Explorer

Posted: Fri Oct 21, 2016 4:34 am
by skywalk
This happens with several apps and Windows Explorer AutoRefresh disabled or not running.
Just hit [F5] to Refresh. Some answers on web.

Re: PB-deleted file still appears in Windows Explorer

Posted: Fri Oct 21, 2016 12:48 pm
by Mijikai
U could call InvalidateRect_(0,0,0) iirc
after the file is deleted to trigger a refresh.

Re: PB-deleted file still appears in Windows Explorer

Posted: Sat Oct 22, 2016 5:36 am
by PB2004
Thanks both! The reason for this is that I really don't want the user to be alarmed by a ghosted, intermediate and temporary file that is part of the app processing. Triggering a refresh of Explorer would be great, but is at present beyond my noobile abilities (having searched for a couple of hours).

I suppose i would need a way to detect if Explorer was open (if not open, no problem), get its window handle (hwnd ?), and then use Mijikai's InvalidateRect_ approach.

If someone has some tight code for this that can handle win7 thru 10 that would be amazing.

Re: PB-deleted file still appears in Windows Explorer

Posted: Sat Oct 22, 2016 8:39 am
by firace
This should work (courtesy of Rebon from the German forum):

Code: Select all

Procedure ReDe()
   hWnd = FindWindow_("Explorer.EXE", #Null)
   InvalidateRect_(hWnd, #Null, 1)
   UpdateWindow_(hWnd)
EndProcedure

ReDe()

Re: PB-deleted file still appears in Windows Explorer

Posted: Mon Oct 24, 2016 5:43 pm
by PB2004
Beautiful. EXACTLY what the noob needed. Thank you so much!