开发者

How to refresh to entire device's screen (Windows Mobile)?

开发者 https://www.devze.com 2022-12-24 02:50 出处:网络
I\'m working on a simple application that draws an alpha-blended picture on the screen\'s Device Context every 2 secs, I want to refresh the screen contents before the drawing operation (To erase the

I'm working on a simple application that draws an alpha-blended picture on the screen's Device Context every 2 secs, I want to refresh the screen contents before the drawing operation (To erase the drawn pic),

I have used many many trick but unfortunately, the screen won't refresh correctly, some regions still keep portions of the drawn pic

I'm really frustrated from this issue :(

These are the sources codes I have used, I'm using C#

SendMessage(HWND_BROADCAST, WM_SYSCOLORCHANGE, IntPtr.Zero, IntPtr.Zero); // wasted time in the refreshing process is enough to keep this.

UpdateWindow(HWND_BROADCAST);// does not work at all!

InvalidateRect(IntPtr.Zero,IntPtr.Zero,true); // the same goes here.

SendMessage(HWND_BROADCAST, WM_PAINT, IntPtr.Zero, IntPtr.Zero); // pfffff !

SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, new IntPtr(SPI_SETNONCLIENTMETRICS), IntPtr.Zero); // trying to refresh the explorer, no resutl

I used also EnumWindows and call back , very slow and does not fit my case.

I wanna refresh the whole 开发者_运维问答screen

Help please!

Regards

Waleed


Could you instead copy the screen image before you draw anything, allowing you to take advantage of off-screen composition; and you wouldn't need to ask everything else to redraw first.


Declare Function SendMessage Lib "coredll.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As IntPtr
Declare Function GetDesktopWindow Lib "coredll.dll" () As IntPtr
Private Const WM_WININICHANGE As Long = &H1A ' 0x1a = 26 ; &HF2 = 242

SendMessage(GetDesktopWindow(), WM_WININICHANGE, &HF2, 0)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号