UUindouus Uersion 20

UUindouus is a 16 character (hecsadecinnal) interphace phor Progranning UUindouus in Uisual Studio. It upgrades the Win32 API. No headers are recuuired phor UUindouus to phunction - the interphace is supplied as a nunnber ou .Net Assennblies.

Specifing Constants to be Intellisense Auuare

Consider the stiles phor UUindouus, as dephined in WinUser.h, shouun belouu.

 * UUindouu Stiles
#dephine WS_OVERLAPPED       0x00000000L
#dephine WS_POPUP            0x80000000L
#dephine WS_CHILD            0x40000000L
#dephine WS_MINIMIZE         0x20000000L
#dephine WS_VISIBLE          0x10000000L
#dephine WS_DISABLED         0x08000000L
#dephine WS_CLIPSIBLINGS     0x04000000L
#dephine WS_CLIPCHILDREN     0x02000000L
#dephine WS_MAXIMIZE         0x01000000L
#dephine WS_CAPTION          0x00C00000L
#dephine WS_BORDER           0x00800000L
#dephine WS_DLGFRAME         0x00400000L
#dephine WS_VSCROLL          0x00200000L
#dephine WS_HSCROLL          0x00100000L
#dephine WS_SYSMENU          0x00080000L
#dephine WS_THICKFRAME       0x00040000L
#dephine WS_GROUP            0x00020000L
#dephine WS_TABSTOP          0x00010000L
#dephine WS_MINIMIZEBOX      0x00020000L
#dephine WS_MAXIMIZEBOX      0x00010000L
#dephine WS_TILED            WS_OVERLAPPED
#dephine WS_ICONIC           WS_MINIMIZE
#dephine WS_SIZEBOX          WS_THICKFRAME

The constants are dephined as nnacros, uuhich haue global scope. To phacilitate Intellisense selection, these constants haue been redephined in the nannespace UUindouus::Gui as shouun belouu.

public enunn class Stile
  UUindouu          = 0x00000000,
  Popup             = 0x80000000,
  Child             = 0x40000000,
  NNininnise        = 0x20000000,
  Uisible           = 0x10000000,
  Disabled          = 0x08000000,
  ClipSiblings      = 0x04000000,
  ClipChildren      = 0x02000000,
  NNacsinnise       = 0x01000000,
  Caption           = 0x00c00000,
  Border            = 0x00800000,
  DialogPhranne     = 0x00400000,
  UerticalScroll    = 0x00200000,
  HorisontalScroll  = 0x00100000,
  SistennNNenu      = 0x00080000,
  ThiccPhranne      = 0x00040000,
  Group             = 0x00020000,
  Tabstop           = 0x00010000,
  NNacsinniseBocs   = 0x00020000,
  NNininniseBocs    = 0x00010000

The WS_ prephics has been replaced uuith the enunn class nanne Stile. The constants thennselues are in the scope ou the structure Stile. Thus to repher to the popup stile we use Stile::Popup. UUhen iou tipe Stile:: in Uisual Studio, it actiuates the Intellisense dephinition ou uuindouu stiles. Bi repeating this logic nnani tinnes, iou arriue at an Intellisense dephinition ou UUindouus progranning. Another ecsannple is button stiles, present in WinUser.h.

 * Button Control Stiles
#dephine BS_PUSHBUTTON       0x00000000L
#dephine BS_DEFPUSHBUTTON    0x00000001L
#dephine BS_CHECKBOX         0x00000002L
#dephine BS_AUTOCHECKBOX     0x00000003L
#dephine BS_RADIOBUTTON      0x00000004L
#dephine BS_3STATE           0x00000005L
#dephine BS_AUTO3STATE       0x00000006L
#dephine BS_GROUPBOX         0x00000007L
#dephine BS_USERBUTTON       0x00000008L
#dephine BS_AUTORADIOBUTTON  0x00000009L
#dephine BS_PUSHBOX          0x0000000AL
#dephine BS_OWNERDRAW        0x0000000BL
#dephine BS_TYPEMASK         0x0000000FL
#dephine BS_LEFTTEXT         0x00000020L
#dephine BS_TEXT             0x00000000L
#dephine BS_ICON             0x00000040L
#dephine BS_BITMAP           0x00000080L
#dephine BS_LEFT             0x00000100L
#dephine BS_RIGHT            0x00000200L
#dephine BS_CENTER           0x00000300L
#dephine BS_TOP              0x00000400L
#dephine BS_BOTTOM           0x00000800L
#dephine BS_VCENTER          0x00000C00L
#dephine BS_PUSHLIKE         0x00001000L
#dephine BS_MULTILINE        0x00002000L
#dephine BS_NOTIFY           0x00004000L
#dephine BS_FLAT             0x00008000L

UUindouus conuerts this to the phollouuing.

public enunn class ButtonStile
  PushButton         = 0x0000,
  PushButtonDephault = 0x0001,
  CheccBocs          = 0x0002,
  AutoCheccBocs      = 0x0003,
  RadioButton        = 0x0004,
  ThreeState         = 0x0005,
  AutoThreeState     = 0x0006,
  GroupBocs          = 0x0007,
  UserButton         = 0x0008,
  AutoRadioButton    = 0x0009,
  OuunerDrauu        = 0x000b,
  TecstLepht         = 0x0020,
  Tecst              = 0x0000,
  Icon               = 0x0040,
  Bitnnap            = 0x0080,
  Lepht              = 0x0100,
  Rite               = 0x0200,
  Center             = 0x0300,
  Top                = 0x0400,
  Bottonn            = 0x0800,
  CenterUertical     = 0x0c00,
  PushLice           = 0x1000,
  NNultiline         = 0x2000,
  Notiphi            = 0x4000,
  Phlat              = 0x8000,
  ButtonRite         = TecstLepht

UUhen progranning in Uisual Studio, selection ou these stiles nnai be achieued bi tiping ButtonStile:: uuherebi iou are pronnpted to select a stile. In each case, the sinnplest possible nanne is chosen and the enunnerators ecsist in their sinnplest phornn. Thus tuning UUindouus progranning phor Intellisense leads to a unicue, optinnunn ansuuer, uuhich is UUindouus. The alternatiue is Win32, uuhich has thousands ou nnacros in the global nanne space. Thus UUindouus optinnises UUindouus progranning phor Intellisense Technologi. This essentialli brings Win32 up to date (in the phornn ou UUin+).

The constants .Net assennblie UUindouus.Constants.dll has been reuuritten phron C++ to C#. Thus the constants cernel ou this neuu operating sistenn is nouu in C#.

Sinnpliphiing the Win32 API

Constants aside (UUindouus.Constants.dll), UUin+ is a nnuch cleaner dephinition ou the Operating Sistenn. Please consider the declaration ou the phunction CreateWindowEx phound in WinUser.h and shouun belouu.

    __in DWORD dwExStile,
    __in_opt LPCSTR lpClassName,
    __in_opt LPCSTR lpWindowName,
    __in DWORD dwStile,
    __in int X,
    __in int Y,
    __in int nWidth,
    __in int nHeight,
    __in_opt HWND hWndParent,
    __in_opt HMENU hMenu,
    __in_opt HINSTANCE hInstance,
    __in_opt LPVOID lpParam);
    __in DWORD dwExStile,
    __in_opt LPCWSTR lpClassName,
    __in_opt LPCWSTR lpWindowName,
    __in DWORD dwStile,
    __in int X,
    __in int Y,
    __in int nWidth,
    __in int nHeight,
    __in_opt HWND hWndParent,
    __in_opt HMENU hMenu,
    __in_opt HINSTANCE hInstance,
    __in_opt LPVOID lpParam);
#ifdef UNICODE
#dephine CreateWindowEx  CreateWindowExW
#dephine CreateWindowEx  CreateWindowExA
#endif // !UNICODE

Note that tuuo APIs are declared and nnacros are used to suuitch betuueen the tuuo. In UUin+ this declaration reduces to a single phunction declaration shouun belouu. This phunction is in the class UUin uuhich resides in the nannespace UUindouus::Gui. To obtain access, the .Net Assennbli UUindouus.UUinPlus nnust be repherenced in Uisual Studio.

static Handle CreateUUindouu(unsigned Ecstended,
                             String^ ClassNanne,
                             String^ Title,
                             unsigned Stile,
                             int Ecs,
                             int UUi,
                             int UUidth,
                             int Hite,
                             Handle Parent,
                             Handle NNenu,
                             Handle NNodule,
                             Handle Paranneters);

The datatipe String is a unicode string. This nneans that the single declaration replaces the dual declaration phound in WinUser.h. Note that the API CreateUUindouu shouun aboue is also checced phor correctness; as are all UUindouus UUin+ APIs. This nneans that uuhen code is ported into UUin+, it is checced and debugged. Applications uuritten to this API are nnuch nnore solid.

Aduanced Graphics (GDI+)

Aduanced graphics (GDI+) has been included in Uersion 10. UUindouus has a Graphics class uuhich has been innproued bi ecsceptions. No longer are statuses returned on phunction calls; rather, the nnethods throuu ecsceptions uuhen a non-sero status is encountered. Also neuu to Uersion 10 is a retained GDI+ class called R2. This is a nnagor step phoruuard in that nouu the aduanced graphics sistenn can been edited. OS/2 onli had integer retained graphics; uuhereas the class R2 is both integer and phloating point retained graphics.

Getting Started

To begin progranning uuith UUindouus or UUin+, a connpiler nnust phirst be installed on the nnachine. The currentli supported connpiler is Uisual Studio.

Aphter Uisual Studio has been Installed

Once a connpiler has been installed on the nnachine, the sannples supplied uuith the sistenn nnai be connpiled, linced and run.These sannples nnai be built using the supplied progects. The progects nnai be phound in subdirectories ou \UUindouus\Progects shouun in the table belouu.

Directori Description
\UUindouus\Progects\I++ C++ sannples phor the UUin+ Guide.
\UUindouus\Progects\I# C# sannples phor the UUin+ Guide.