VB API First Lesson GETDC call

Source: Internet
Author: User

function function:

The GetDC function user obtains the device environment handle for the client area or entire screen of the specified window, and then you can use the handle in the GDI function to draw in the device environment.

A device environment is an undisclosed data structure whose values are used internally by GDI functions.

Gets the handle of the device called GetDC, first declares

Private Declare Function GetDC Lib "user32" (ByVal hwnd as long) as long

Parameter resolution:

Parameters Meaning
HWnd 1. The specified window handle
2. If the value is NULL, get the entire screen of the device environment



return value:

1. If the function call succeeds, the return value is the device environment handle for the client area of the specified window;

2. If the function call fails, the return value is NULL.

Example

Get the device handle for a form

Option Explicit

Private Declare Function GetDC Lib "user32" (ByVal hwnd as long) as long

Private Sub Command1_Click ()
Dim Formhdc as Long
FORMHDC = GetDC (Form1.hwnd)
Print FORMHDC
End Sub

It's so easy! Continue to update in ...

VB API First Lesson GETDC call

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.