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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
the data type is long, and it's the form handle of the drawing control
william007Author Commented:
Hi, what is drawing control?
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:

for normal applications, you don't need it, but as soon as you implement graphics or subclassing, this will be an important element.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

william007Author Commented:
Hi, so in this case(Code showing in the question), the hdc refer to the form itself?
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...
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"


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
william007Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.