Windows API Guide: CharUpper Function


Declare Function CreatePenIndirect Lib "gdi32.dll" (lpLogPen As LOGPEN) As Long

Platforms

  • Windows 95: Supported.
  • Windows 98: Supported.
  • Windows NT: Requires Windows NT 3.1 or later.
  • Windows 2000: Supported.
  • Windows CE: Requires Windows CE 1.0 or later.

Description & Usage

CreatePenIndirect creates a pen object. The pen created is the one which is described by the logical pen information in the structure passed to the function. After your program is finished using the pen, it should be deleted via the DeleteObject function.

Return Value

If an error occured, the function returns 0 (Windows NT, 2000: use GetLastError to get the error code). If successful, the function returns a handle to the newly created pen.

Visual Basic-Specific Issues

None.

Parameters

lpLogPen
The description of the attributes to give to the newly created pen.

Example

' This code is licensed according to the terms and conditions listed here. ' Draw an ellipse on window Form1 using a one-pixel-wide ' square dashed green pen. Dim hPen As Long  ' handle to the pen created Dim hOldPen As Long  ' handle to Form1's previously selected pen Dim lpinfo As LOGPEN  ' holds description of the pen Dim retval As Long  ' return value ' Create the square dashed green pen with a width of zero (always one pixel). lpinfo.lopnStyle = PS_DASH  ' dashed line lpinfo.lopnWidth.x = 0  ' minimum width lpinfo.lopnWidth.y = 0  ' this member is ignored lpinfo.lopnColor = RGB(0, 255, 0)  ' green hPen = CreatePenIndirect(lpinfo) ' Select the pen for use by window Form1. hOldPen = SelectObject(Form1.hDC, hPen) ' Draw an ellipse with bounding rectangle (100,150)-(350,300). retval = Ellipse(Form1.hDC, 100, 150, 350, 300) ' Select the old pen for use by Form1. retval = SelectObject(Form1.hDC, hOldPen) ' Delete the pen we created to free up resources. retval = DeleteObject(hPen)

See Also

CreatePen

Category

Pens

Go back to the alphabetical Function listing.
Go back to the Reference section index.


Last Modified: October 16, 1999
This page is copyright © 1999 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/c/createpenindirect.html



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net