Jump to content

WinBeginPaint: Difference between revisions

From EDM2
Ak120 (talk | contribs)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=== Syntax ===
This function is called (normally in a WM_PAINT message) to obtain presentation space for drawing in a specified window.
hps = WinBeginPaint( ''hwnd'',
                      ''hps'',
                      ''prcl'' );


=== Parameters ===
==Syntax==
;HWND ''hwnd'' (input)
hps = WinBeginPaint( ''hwnd'', ''hps'', ''prcl'' )
:A window handle to where the drawing is going to occur.
 
;HPS ''hps'' (input)
== Parameters ==
:A handle to presentation space.
;HWND ''hwnd'' (input):A window handle to where the drawing is going to occur.
;PRECTL ''prcl'' (input)
;HPS ''hps'' (input):A handle to presentation space.
:A pointer to the bounding rectangle. The value must be in the range of -32,767 through 32,767. A NULL value indicates no bounding rectangle (the whole window will be painted).
;PRECTL ''prcl'' (input):A pointer to the bounding rectangle. The value must be in the range of -32,767 through 32,767. A NULL value indicates no bounding rectangle (the whole window will be painted).
   
   
=== Returns ===
== Returns ==
HPS hps
;HPS hps:Handle to the newly created presentation space. NULLHANDLE is returned if there was an error. WinGetLastError will return one of:
Handle to the newly created presentation space. NULLHANDLE is returned if there was an error. WinGetLastError will return one of:
{|class="wikitable"
{|class="wikitable"
|0x1001
|0x1001
Line 23: Line 19:
|}
|}


=== Include Info ===
== Include Info ==
  #define INCL_WINWINDOWMGR
  #define INCL_WINWINDOWMGR
  #include <os2.h>
  #include <os2.h>


=== Usage Explanation ===
==Sample Code==
This function is called (normally in a WM_PAINT message) to obtain presentation space for drawing in a specified window.
<pre>
=== Sample Code ===
<pre>  
#define INCL_WINWINDOWMGR
#define INCL_WINWINDOWMGR
#include  
#include  
Line 52: Line 45:
</pre>
</pre>


=== See Also ===
==See Also==
*[[WinEndPaint]]
* [[WinEndPaint]]
*WinExcludeUpdateRegion
* [[WinExcludeUpdateRegion]]
*WinGetClipPS
* [[WinGetClipPS]]
*WinGetPS
* [[WinGetPS]]
*WinGetScreenPS
* [[WinGetScreenPS]]
*WinInvalidateRect
* [[WinInvalidateRect]]
*WinInvalidateRegion
* [[WinInvalidateRegion]]
*WinIsWindowShowing
* [[WinIsWindowShowing]]
*WinIsWindowVisible
* [[WinIsWindowVisible]]
*WinLockVisRegions
* [[WinLockVisRegions]]
*WinOpenWindowDC
* [[WinOpenWindowDC]]
*WinQueryUpdateRect
* [[WinQueryUpdateRect]]
*WinQueryUpdateRegion
* [[WinQueryUpdateRegion]]
*WinRealizePalette
* [[WinRealizePalette]]
*WinReleasePS
* [[WinReleasePS]]
*WinShowWindow
* [[WinShowWindow]]
*WinUpdateWindow
* [[WinUpdateWindow]]
*WinValidateRect
* [[WinValidateRect]]
*WinValidateRegion
* [[WinValidateRegion]]
 
[[Category:Win]]
[[Category:Win]]

Latest revision as of 18:32, 14 May 2025

This function is called (normally in a WM_PAINT message) to obtain presentation space for drawing in a specified window.

Syntax

hps = WinBeginPaint( hwnd, hps, prcl )

Parameters

HWND hwnd (input)
A window handle to where the drawing is going to occur.
HPS hps (input)
A handle to presentation space.
PRECTL prcl (input)
A pointer to the bounding rectangle. The value must be in the range of -32,767 through 32,767. A NULL value indicates no bounding rectangle (the whole window will be painted).

Returns

HPS hps
Handle to the newly created presentation space. NULLHANDLE is returned if there was an error. WinGetLastError will return one of:
0x1001 PMERR_INVALID_HWND
0x207F PMERR_INV_HPS

Include Info

#define INCL_WINWINDOWMGR
#include <os2.h>

Sample Code

#define INCL_WINWINDOWMGR
#include 
   .
   .
   .
case WM_PAINT:
    hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);

    WinQueryWindowRect(hwnd, &rcl);

    WinDrawText(hps, -1, "Hello World", &rcl, CLR_NEUTRAL, CLR_BACKGROUND,
                DT_CENTER | DT_VCENTER | DT_ERASERECT);

    WinEndPaint(hps);
    return 0;
   .
   .
   .

See Also