April 7, 2001

From MSXML3.0 to .NET XML Classes: A Quick Guide

Introduction As you have probably heard thousands oftimes, XML is a core technology in .NET. XML is a cornerstone of web services and ADO.NET recordsets (now calleddatasets) are internally stored as xml. You have great support for XML manipulation in .NET via its XML classes. In this article I want

DrawSystemIcon – Draw a system icon on any device context

Private Declare Function LoadIconByID Lib “user32” Alias “LoadIconA” (ByVal _ hInstance As Long, ByVal lpIconName As Long) As LongPrivate Declare Function DrawIcon Lib “user32” (ByVal hDC As Long, _ ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As LongEnum SystemIconConstants IDI_APPLICATION = 32512 IDI_HAND = 32513

GetBitmapInfo – Retrieve width, height and colors in a bitmap

Type BITMAP bmType As Long bmWidth As Long bmHeight As Long bmWidthBytes As Long bmPlanes As Integer bmBitsPixel As Integer bmBits As LongEnd TypePrivate Declare Function GetObjectAPI Lib “gdi32” Alias “GetObjectA” (ByVal _ hObject As Long, ByVal nCount As Long, lpObject As Any) As Long’ Returns info on a bitmap

IconToPicture – Convert an icon handle to a Picture object

Private Type PICTDESC cbSize As Long pictType As Long hIcon As Long hPal As LongEnd Type Private Declare Function OleCreatePictureIndirect Lib “olepro32.dll” _ (lpPictDesc As PICTDESC, riid As Any, ByVal fOwn As Long, _ ipic As IPicture) As Long’ Convert an icon handle to a Picture objectFunction IconToPicture(ByVal hIcon As

MoveProgressBarIntoPanel – Move a ProgressBar inside a StatusBar’s panel

‘ Move and resize a ProgressBar control so that it fits inside’ a StatusBar’s Panel.” The last argument is the panel index (one-based).Sub MoveProgressBarIntoPanel(pb As ProgressBar, sb As StatusBar, _ pnlIndex As Integer) Dim deltaY As Single, pnl As Panel, y As Single ‘ account for two pixels around each

GetScreenSnapshot – Capture a window or the entire screen

Private Type RECT Left As Long Top As Long Right As Long Bottom As LongEnd TypePrivate Type PICTDESC cbSize As Long pictType As Long hIcon As Long hPal As LongEnd Type Private Declare Function OleCreatePictureIndirect Lib “olepro32.dll” _ (lpPictDesc As PICTDESC, riid As Any, ByVal fOwn As Long, _ ipic

GetSystemIcon – Get a Windows standard icon as a StdPicture object

Private Declare Function LoadStandardIcon Lib “user32” Alias “LoadIconA” (ByVal _ hInstance As Long, ByVal lIconID As Long) As LongEnum SystemIconConstants IDI_Application = 32512 IDI_Hand = 32513 IDI_Question = 32514 IDI_Exclamation = 32515 IDI_Asterisk = 32516 IDI_Windows = 32517End Enum’ returns a Windows standard icon ‘ (e.g. the icons used in