Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie VFP to VB questions
Message
 
To
15/08/2000 09:36:01
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00403929
Message ID:
00409265
Views:
14
>>But what you gain by working with real objects (handles, hDCs and the like)
>
>could you explain what those (handles, hDCs and the like) are and what I can do with them?

Handles and hDC are part of the Windows OS. All objects that are created in the OS layer will have them. A Handle is just that, a handle to an object. The OS holds all the objects that you are working with so that it knows when an object needs to be redrawn on the screen for example. An hDC is a device Context. The way that I think of this is that the handle is a pointer to the object, while the hDC gives you a way to paint on it. (hDCs may be more useful than that, but I haven't explored it enough.)

Handles and hDCs are not natively useful to VB. (As I'm sure you've seen in the functions that you've worked with so far, none call for an hDC.) Where the power of hDCs and handles come in is when you work with the OS. For example, if you want to force a window to be always on top (top of the ZORDER) for all of windows, one way that could be done is with a call to the Windows API SetWindowsPos function. This function requires an hWnd (or handle.) VB gives you handles to most (if not all) objects.

If you're intrested in checking out API commands, one site that I use frequently, is www.vbapi.com - it contians a good, but not exhaustive, list of API commands defined for VB, with examples. There are many neat tricks that you can preform with API commands that you cannot do natively with VB, or VFP for that matter.

Where VB's power for these comes from is that it works with the real objects of the operating sytem. VFP paints all the controls on a real form. This is why you can't get a handle to any of the objects on the form, they don't exist at the OS level. As a consequence, VB makes it much easier to interface with OS level commands.

I hope that this helps.

Ben Keene
Previous
Reply
Map
View

Click here to load this message in the networking platform