Desktop icon refresh

Everything else that doesn't fall into one of the other PB categories.
User avatar
Mischa
Enthusiast
Enthusiast
Posts: 115
Joined: Fri Aug 15, 2003 7:43 pm

Desktop icon refresh

Post by Mischa »

Hi!

Simple question. Why does the first call of an OpenFileRequester() forces an icon refresh on desktop?
And how can i turn off this annoying flickering? :evil: :wink:

Regards,
Mischa
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Desktop icon refresh

Post by BarryG »

Mischa wrote:Why does the first call of an OpenFileRequester() forces an icon refresh on desktop?
Just your PC. Doesn't happen on both my PCs here.
User avatar
KJ67
Enthusiast
Enthusiast
Posts: 218
Joined: Fri Jun 26, 2009 3:51 pm
Location: Westernmost tip of Norway

Re: Desktop icon refresh

Post by KJ67 »

BarryG wrote:
Mischa wrote:Why does the first call of an OpenFileRequester() forces an icon refresh on desktop?
Just your PC. Doesn't happen on both my PCs here.
I'm on a updated Win10 highend corparate laptop [nothing funny installed] and also get a icon update on the desktop with just:

Code: Select all

OpenFileRequester("", "", "", 0)
Seems to be an issue on atleast some setups.
The best preparation for tomorrow is doing your best today.
User avatar
Mischa
Enthusiast
Enthusiast
Posts: 115
Joined: Fri Aug 15, 2003 7:43 pm

Re: Desktop icon refresh

Post by Mischa »

Thanks for reply.

Hm. Ok, this happens not only on my pc, how comforting. :|
The question is, if this is a windows 10 bug, and much more important,
if there is a workaround? Maybe some kind of temporary 'DisableIconRefresh' or anything?

I mean, this is a really, really annoying thing, in particular because my programm starts
with an OpenFileRequester without a desktop overlapping main window.
So every start produces heavy flickering. :cry:
By the way, the second call to the file requester produces NO flickering.

Can anybody help here?

Regards,
Mischa
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Desktop icon refresh

Post by BarryG »

Does it still happen if you open a temp invisible window first? Like this:

Code: Select all

OpenWindow(0,200,200,200,200,"",#PB_Window_Invisible)
OpenFileRequester("", "", "", 0)
cas
Enthusiast
Enthusiast
Posts: 597
Joined: Mon Nov 03, 2008 9:56 pm

Re: Desktop icon refresh

Post by cas »

This is not a bug, it is just the way that Windows OS works. Here are some explanations that i found with a quick google search that explain what is happening and how to possibly prevent it:
https://stackoverflow.com/questions/576 ... -is-opened
https://superuser.com/questions/1330350 ... ens-a-file
User avatar
Mischa
Enthusiast
Enthusiast
Posts: 115
Joined: Fri Aug 15, 2003 7:43 pm

Re: Desktop icon refresh

Post by Mischa »

BarryG wrote:Does it still happen if you open a temp invisible window first? Like this:

Code: Select all

OpenWindow(0,200,200,200,200,"",#PB_Window_Invisible)
OpenFileRequester("", "", "", 0)
Yes, it makes no difference.
I've testet this before.
User avatar
Mischa
Enthusiast
Enthusiast
Posts: 115
Joined: Fri Aug 15, 2003 7:43 pm

Re: Desktop icon refresh

Post by Mischa »

cas wrote:This is not a bug, it is just the way that Windows OS works. Here are some explanations that i found with a quick google search that explain what is happening and how to possibly prevent it:
https://stackoverflow.com/questions/576 ... -is-opened
https://superuser.com/questions/1330350 ... ens-a-file
Thanks for the info.
It looks like i can do nothing inside my code to prevent the effect. :?
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Desktop icon refresh

Post by BarryG »

That's weird cas, because it never happens to my desktops icons. I'm on Win 10 Pro with the latest updates.

BTW, I don't know if disabling the desktop redraw (temporarily) might help?

Code: Select all

hWnd=FindWindow_("Progman","Program Manager")
SendMessage_(hWnd,#WM_SETREDRAW,0,0) ; Disable.
OpenFileRequester("", "", "", 0)
SendMessage_(hWnd,#WM_SETREDRAW,1,0) ; Enable.
Note: You might need to change the hWnd to something else, like hWnd=GetDesktopWindow_() or a child window of the hWnd shown in my code.

BTW, a working brute-force fix is to copy a screenshot of your desktop to an image, then show that image in full-screen before opening the dialog. Can't see the icons refresh if the desktop isn't visible (taps forehead). Hehe.
User avatar
Mischa
Enthusiast
Enthusiast
Posts: 115
Joined: Fri Aug 15, 2003 7:43 pm

Re: Desktop icon refresh

Post by Mischa »

BarryG wrote:That's weird cas, because it never happens to my desktops icons. I'm on Win 10 Pro with the latest updates.

BTW, I don't know if disabling the desktop redraw (temporarily) might help?

Code: Select all

hWnd=FindWindow_("Progman","Program Manager")
SendMessage_(hWnd,#WM_SETREDRAW,0,0) ; Disable.
OpenFileRequester("", "", "", 0)
SendMessage_(hWnd,#WM_SETREDRAW,1,0) ; Enable.
Note: You might need to change the hWnd to something else, like hWnd=GetDesktopWindow_() or a child window of the hWnd shown in my code.

BTW, a working brute-force fix is to copy a screenshot of your desktop to an image, then show that image in full-screen before opening the dialog. Can't see the icons refresh if the desktop isn't visible (taps forehead). Hehe.
Thanks for your ideas.
Your code freezes full Desktop/App, had to kill purebasic in taskmanager. :twisted: :D

The brute-force method is a little bit overkill, i think. You also have to close fake desktop inside thread, cause else you can't use the dialog. :?

No, no, i think i can live with this little flaw. :evil: :cry: :)

Regards,
Mischa
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Desktop icon refresh

Post by BarryG »

Mischa wrote:Your code freezes full Desktop/App, had to kill purebasic in taskmanager
Oops, yes, it will lock the desktop until the file dialog is closed. But you could use OpenFileRequester() in a thread to avoid that.
Mischa wrote:No, no, i think i can live with this little flaw
Well, it's a Windows issue, not a PureBasic bug.
Post Reply