Questions tagged [wm-paint]

WM_PAINT is a central message in the classic Microsoft Windows API.

The WM_PAINT message is central in the classic Microsoft Windows API. It is sent to a window when it needs to redraw (a portion of) its content.

77 questions
11
votes
3 answers

Invalidate into own bitmap

I wish to off-screen render a Control to some bitmap so that I have quick access to it. Unfortunately Control.DrawToBitmap seems to draw the entire control on which it is called including all it's child controls. Internally it issues a WM_PRINT…
Frank Razenberg
  • 511
  • 4
  • 17
11
votes
7 answers

SetWindowsHookEx in C#

I'm trying to hook a 3rd party app so that I can draw to its screen. Drawing to the screen is easy, and I need no help with it, but I seem to be having issues with using SetWindowsHookEx to handle WH_GETMESSAGE. I can't figure out what to pass for…
Darthg8r
  • 12,377
  • 15
  • 63
  • 100
9
votes
3 answers

Is there something special about using BeginPaint/EndPain and not GetDC/ReleaseDC in response to WM_PAINT message?

One can use GetDC/ReleaseDC to draw in client area of window. But in response to WM_PAINT message one have to use BeginPaint/EndPaint. Is there something special about this?
Vadim
  • 1,223
  • 2
  • 17
  • 26
7
votes
1 answer

How can I draw an animation on a transparent window using Windows API?

I'm trying to draw an animation on a window with a transparent background using Windows API. The problem is that I can't delete the previous drawing from the window. I set the following parameters: InvalidateRect(m_hWnd, &sClientRect, TRUE); // we…
tal
  • 281
  • 3
  • 7
6
votes
3 answers

On Win32, can I disable painting of a window for a period of time?

Is there a function that will freeze window repainting for some time, while I do changes to the layout of my dialog?
sashoalm
  • 75,001
  • 122
  • 434
  • 781
5
votes
4 answers

why not to send WM_PAINT manually

I have read that I should never send WM_PAINT manually and should call InvalidateRect instead but didn't found anything about why not, however. So why not? update works with InvalidateRect but not with SendMessage(WM_PAINT) LRESULT CALLBACK…
Ivars
  • 2,375
  • 7
  • 22
  • 31
5
votes
3 answers

Occasional EAccessViolation in VCL/comctl32.dll/USER32.dll/GDI32.dll after receiving WM_PAINT

I need some suggestions for debugging a crash in a Delphi XE2 application. I've never seen the crash myself - indeed it occurs very rarely and is not reproducible on demand. We do though have a set of 10 crash reports from MadExcept. These show…
Ian Goldby
  • 5,609
  • 1
  • 45
  • 81
4
votes
1 answer

Improve code for WM_PAINT and WM_CTLCOLORSTATIC handlers

INTRODUCTION AND RELEVANT INFORMATION: I have implemented complex painting of the main window’s background and its child static controls. The picture below shows how it looks. Static controls have SS_NOTIFY style, which is important to mention, as…
AlwaysLearningNewStuff
  • 2,939
  • 3
  • 31
  • 84
3
votes
5 answers

C++ programming efficiency

Here is some code that I copied from the Microsoft Developer Network http://msdn.microsoft.com/en-us/library/dd162487(v=VS.85).aspx LRESULT APIENTRY WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { **PAINTSTRUCT ps; HDC…
Morshu
  • 35
  • 4
3
votes
1 answer

Intercepting a WM_PAINT message and acting upon this

I'm trying to intercept/hook the WM_PAINT message of the desktop in C++. I'm currently drawing with the desktop handle, my only problem is that I'm not in sync so it might flicker. What I basically would like is a statement where I can check on the…
Yonathan
  • 1,253
  • 1
  • 17
  • 29
3
votes
1 answer

Why is WM_PAINT sometimes called with empty rectangle?

I'm dealing a lot with drawing. Currently I'm using WM_TIMER to schedule painting using InvalidateRect. For some reason WM_PAINT is then very often called with region (0,0,0,0), so basically an empty rectangle. I tried to interpret this as "the…
Vojtěch Melda Meluzín
  • 1,117
  • 3
  • 11
  • 22
3
votes
1 answer

GetDC vs BeginPaint performance considerations

MSDN and numerous post have suggested that BeginPaint/EndPaint should used in WM_PAINT. I've also seen numerous places suggesting that if double buffering is employed in painting, it makes more sense to initialize the DC and mem allocation in…
dave
  • 376
  • 4
  • 17
2
votes
0 answers

WM_PAINT, Java and capturing hidden windows

First a disclaimer, I'm a Java programmer and have almost no idea about the Windows API. So please bear with me. My goal is to use Java to capture a hidden window. My target platform is Windows. I do understand that the Robot class is used for…
Klaus
  • 2,328
  • 5
  • 41
  • 62
2
votes
1 answer

Drawing a Line Outside of WM_PAINT

Usually, to draw a line we draw it in WM_PAINT LRESULT CALLBACK Display::DisplayWindowProc(HWND hWnd,UINT msg,WPARAM wParamm,LPARAM lParam) { HDC hdc; PAINTSTRUCT ps; switch(msg) { case WM_PAINT: hdc =…
2
votes
3 answers

WinAPI: Omitting BeginPaint & EndPaint in WM_PAINT causes 100% CPU usage

When handling the WM_PAINT message, I omitted the BeginPaint and EndPaint calls, and the CPU usage shot up to 100%. Why is this? I'm also using worker threads... but they do something different and seem to have no influence on this matter. Also, can…
user3235832
1
2 3 4 5 6