Low-Level Members
The .NET framework hides the low-level ugliness of the Windows API, but it doesn't render it inaccessible. This is a major advantage of .NET over other frameworks like traditional VB: it adds features without removing any capabilities.
For example, if you want to use a DLL or Windows API function that requires a window handle, you can just retrieve the control's Handle property. The only special .NET consideration is that you should retrieve the handle immediately before you use it. Changing some properties can cause the control to be recreated, and receive a new handle.
You've probably also realized by now that low-level Windows messages are abstracted away in .NET controls, and replaced with more useful events that bundle additional information. If, however, you need to react to a message that doesn't have a corresponding event, you can handle it directly by overriding the PreProcessMessage() method. (You can also attach global message filters for your entire application by using the Application.AddMessageFilter() method).
This book focuses on pure .NET programming, and won't get into most of these tricks, which are really workarounds based on traditional Windows programming. If you do want to examine these features, try starting with the members described in Table 3-7.
Table 3-7: Low-Level Members
MemberDescription
Handle
Provides an IntPtr structure (a 32-bit integer on 32-bit operating systems) that represents the current control's window handle.
RecreatingHandle
Set to true while the control is being re-created with a new handle.
GetStyle() and SetStyle()
Sets or gets a control style bit. Generally you will use higher-level properties to accomplish the same thing.
PreProcessMessage(),
cessCmdKey(),
ProcessKeyMessage(),
ProcessKeyPreview(),
and WndProc()
These methods are involved in processing a Windows message, which is represented as a Message structure. You can override these methods and use them to process special messages or block standard ones.