We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

What is hdc

william007
william007 asked
on
Medium Priority
791 Views
Last Modified: 2012-08-14
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?
Comment
Watch Question

Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
the data type is long, and it's the form handle of the drawing control

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Hi, what is drawing control?
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
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.

Author

Commented:
Hi, so in this case(Code showing in the question), the hdc refer to the form itself?
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
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...
Commented:
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

Author

Commented:
Thanks:-)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.