Page 1 of 1

Desktop icon refresh

Posted: Sun Apr 04, 2021 12:00 am
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

Re: Desktop icon refresh

Posted: Sun Apr 04, 2021 12:20 am
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.

Re: Desktop icon refresh

Posted: Sun Apr 04, 2021 7:04 am
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.

Re: Desktop icon refresh

Posted: Sun Apr 04, 2021 7:52 am
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

Re: Desktop icon refresh

Posted: Sun Apr 04, 2021 9:35 am
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)

Re: Desktop icon refresh

Posted: Sun Apr 04, 2021 9:45 am
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

Re: Desktop icon refresh

Posted: Sun Apr 04, 2021 11:43 am
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.

Re: Desktop icon refresh

Posted: Sun Apr 04, 2021 11:45 am
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. :?

Re: Desktop icon refresh

Posted: Sun Apr 04, 2021 12:24 pm
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.

Re: Desktop icon refresh

Posted: Sun Apr 04, 2021 5:55 pm
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

Re: Desktop icon refresh

Posted: Mon Apr 05, 2021 3:55 am
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.