Force Desktop Refresh
BlitzPlus Forums/BlitzPlus Programming/Force Desktop Refresh
| ||
Is there any way to force re-drawing of (particular area of ) the desktop? For example, if the Desktop buffer has been drawn to, artifacts will remain on the desktop until Windows re-draws that area. Is there anything in User32.dll or Gdi32.dll etc. that may help here? |
| ||
Hmm. This apparently supposed to do a full desktop refresh(haven't been able to test): RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters 1, True Or probably more usefull the MSDN docs to RedrawWindow function in User32.dll: https://msdn.microsoft.com/en-us/library/dd162911(v=vs.85).aspx Which says under Parameters: hWnd [in] - A handle to the window to be redrawn. If this parameter is NULL, the desktop window is updated. So not sure if this is correct, but probably something like: User32_RedrawWindow%(hwnd%, rect%, hrgn%, uint%):"RedrawWindow" |
| ||
http://www.blitzbasic.com/Community/posts.php?topic=104741 http://www.blitzbasic.com/codearcs/codearcs.php?code=3212 |
| ||
I did try this, but it didn't function as intended: "RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters 1, True " Thanks, for all the otehr suggestions, tooo, though - I should be able to find what I need there! |
| ||
.Lib"user32.dll" User32_RedrawWindow% (hwnd%, lprcUpdate*, hrgnUpdate%, fuRedraw%) : "RedrawWindow" "Unknown decls directive" :( |
| ||
I think that should be.Lib "user32.dll" api_RedrawWindow% (hwnd%, lprcUpdate*, hrgnUpdate%, fuRedraw%) : "RedrawWindow" A bunch of other user32 functions, if needed: http://www.blitzbasic.com/codearcs/codearcs.php?code=1179 |
| ||
The api_RedrawWindow% or user32_RedrawWindow% is just the function name as used in Blitz, provided the return type is correct (%), It doesn't affect anything, so changing that makes no difference. It doesn't seem to have any effect at all whether or not there is a space between .Lib and "user32.dll" either. I suspect the issue may be some virtualisation / UAC preventing direct access to Syswow or system32 directory since I'm using a limited account here. |
| ||
If you want to redraw the content of a window which becomes the active window after it was not the active window (if the user has previously clicked on the desktop or on the taskbar or on another window), the approach i have described here : http://www.blitzbasic.com/codearcs/codearcs.php?code=3212 works properly on windows xp, windows vista, windows 7, windows 8. You don't need to use RedrawWindow() you need to use SetWindowPos() with the appropriate flags... |
| ||
It's the actual desktop buffer. I was working in a 'desk pet' type program where the drawing is actually on the desktop. Artefacts remain drawn since the actual desktop elements are not redrawn until updated or the mouse cursor moves over them. |
| ||
Oh i see. I misunderstood, i thought you were talking about a window. |
| ||
It's mlost likely not going to be something readily satisfactorily solved without in depth use of the DWM or other Windows API calls. Probably BlitzPlus is not really the best intended for this type of app |