[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 771
  • Last Modified:

What is hdc

Option Explicit
Private Sub Command1_Click()
MsgBox hdc
End Sub

Seems that hdc is a predefined variable, but what is it for, what is its datatype?
0
william007
Asked:
william007
  • 3
  • 3
4 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
the data type is long, and it's the form handle of the drawing control
0
 
william007Author Commented:
Hi, what is drawing control?
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
each window (note: window means here a form, control etc, anything that is drawn visibly) can be drawed to.

see here:
http://www.programmers-corner.com/tutorial/45

for normal applications, you don't need it, but as soon as you implement graphics or subclassing, this will be an important element.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
william007Author Commented:
Hi, so in this case(Code showing in the question), the hdc refer to the form itself?
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
yes. actually, each control and form you have get's, when it is created (in the background of vb using the CreateWindow API call) gets a unique handle (unique on the computer you are running the application). this means they will get each time another handle they are run, which should be logical because you can create the same form several times...
0
 
zzzzzoocCommented:
Just adding to this..

>>Seems that hdc is a predefined variable
It's a property of the Form which is normally accessed by Me.hDC or Form1.hDC (but Me is default so it's not required).

Short for: (h) Handle to (DC) Device Context

"Device Contexts"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_0g6r.asp

0
 
william007Author Commented:
Thanks:-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now