I++ Version 16.2

I++ is a C++ Interface for Programming Windows in Visual Studio.

Specifing Constants to be Intellisense Aware

Consider the styles for Windows, as defined in WinUser.h, shown below.

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

The constants are defined as macros, which have global scope. To facilitate Intellisense selection, these constants have been redefined in the namespace Windows as shown below.

struct Style : public Point
{
 Style(unsigned Standard=0,
       unsigned Extended=0) : Point(Standard,Extended) {}

 Style(Point Copy) : Point(Copy) {}

 enum Standard
 {
  Window            = 0x00000000,
  Popup             = 0x80000000,
  Child             = 0x40000000,
  Minimize          = 0x20000000,
  Visible           = 0x10000000,
  Disabled          = 0x08000000,
  ClipSiblings      = 0x04000000,
  ClipChildren      = 0x02000000,
  Maximize          = 0x01000000,
  Caption           = 0x00c00000,
  Border            = 0x00800000,
  DialogFrame       = 0x00400000,
  VerticalScroll    = 0x00200000,
  HorizontalScroll  = 0x00100000,
  SystemMenu        = 0x00080000,
  ThickFrame        = 0x00040000,
  Group             = 0x00020000,
  Tabstop           = 0x00010000,
  MaximizeBox       = 0x00020000,
  MinimizeBox       = 0x00010000,
  
  Standard          = Window        |
                      Caption       |
                      SystemMenu    |
                      ThickFrame    |
                      MinimizeBox   |
                      MaximizeBox,

  PopupWindow       = Popup         |
                      Border        |
                      SystemMenu,

  SizeBox           = ThickFrame
 };
};

The WS_ prefix has been replaced with the structure name Style. The constants themselves are in the scope of the structure Style. Thus to refer to the popup style we use Style::Popup. When you type Style:: in Visual Studio, it activates the Intellisense definition of window styles. By repeating this logic many times, you arrive an Intellisense definition of Windows programming. Another example is button styles, present in WinUser.h.

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

I++ converts this to the following.

struct ButtonStyle
{
 enum
 {
  PushButton        = 0x0000,
  PushButtonDefault = 0x0001,
  CheckBox          = 0x0002,
  AutoCheckBox      = 0x0003,
  RadioButton       = 0x0004,
  ThreeState        = 0x0005,
  AutoThreeState    = 0x0006,
  GroupBox          = 0x0007,
  UserButton        = 0x0008,
  AutoRadioButton   = 0x0009,
  OwnerDraw         = 0x000b,
  TextLeft          = 0x0020,
  Text              = 0x0000,
  Icon              = 0x0040,
  Bitmap            = 0x0080,
  Left              = 0x0100,
  Right             = 0x0200,
  Center            = 0x0300,
  Top               = 0x0400,
  Bottom            = 0x0800,
  CenterVertical    = 0x0c00,
  PushLike          = 0x1000,
  Multiline         = 0x2000,
  Notify            = 0x4000,
  Flat              = 0x8000,
  ButtonRight       = TextLeft
 };
};

When programming in Visual Studio, selection of these styles may be achieved by typing ButtonStyle:: whereby you are prompted to select a style. In each case, the simplest possible name is chosen and the enumerators exist in their simplest form. Thus tuning Windows programming for Intellisense leads to a unique, optimum answer, which is I++. The alternative is Win32, which has thousands of macros in the global name space - an intellisense selection nightmare. Thus I++ optimizes Windows programming for Intellisense Technology. This essentially brings Win32 up to date (in the form of Win+).

Simplifying the Win32 API

Constants aside, Win+ is a much cleaner definition of the Operating System. The headers are almost 1/2 the size of the original headers. Please consider the declaration of the function CreateWindowEx found in WinUser.h and shown below.

WINUSERAPI
HWND
WINAPI
CreateWindowExA(
    __in DWORD dwExStyle,
    __in_opt LPCSTR lpClassName,
    __in_opt LPCSTR lpWindowName,
    __in DWORD dwStyle,
    __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);
WINUSERAPI
HWND
WINAPI
CreateWindowExW(
    __in DWORD dwExStyle,
    __in_opt LPCWSTR lpClassName,
    __in_opt LPCWSTR lpWindowName,
    __in DWORD dwStyle,
    __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
#define CreateWindowEx  CreateWindowExW
#else
#define CreateWindowEx  CreateWindowExA
#endif // !UNICODE

Note that two APIs are declared and macros are used to switch between the two. In Win+ this declaration reduces to a single function declaration shown below.

Handle standard CreateWindowExtended(unsigned Extended,
                                     const Character* ClassName,
                                     const Character* Title,
                                     unsigned Style,
                                     int X,
                                     int Y,
                                     int Width,
                                     int Height,
                                     Handle Parent,
                                     Handle Menu,
                                     Handle Module,
                                     void* Parameters);

The datatype Character is either char or wchar_t depending upon whether the macro unicode is defined. This means that the single declaration replaces the dual declaration found in WinUser.h. In I++, there are two libraries to be linked with: Windows.lib or WindowsW.lib. The first of these libraries links with the ASCII version of CreateWindowExtended and the second of these libraries links with the Unicode version. Thus, by shifting the selection of the API to link time rather than compile time, the declarations are halved and the ugly macros have disappeared. The form of this example has been repeated many times throughout the system. By applying some thought to the process, Win+ has managed to simplify and beautify the declaration of Operating System APIs.

Advanced Graphics (GDI+)

Advanced graphics (GDI+) has been included in Version 10. I++ has a Graphics class which has been improved by exceptions. No longer are statuses returned on function calls; rather, the methods throw exceptions when a non-zero status is encountered. Also new to Version 10 is a retained GDI+ class called Space. This is a major step forward in that now the advanced graphics system can been edited. OS/2 only had integer retained graphics; whereas the class Space is both integer and floating point retained graphics. The Analog Clock program has been supplied in Chapter 11 of the I++ Guide. It demonstrates how to use retained GDI+ graphics to draw an antialiased clock. Version 15 and above has a single and double byte interface for GDI+. This means that entirely single byte graphics applications can be written.

Summarizing

In recent times, most of the effort of the vendor of the OS has been directed towards C#. The vendor has left the C++ interface back in the 1980's. I++ fills the gap left by a legacy C system by modernizing the C++ interface as well (as C#). C++ local enums have been used to gain Intellisense support. Dual ASCII/Unicode API declarations have been simplified. Reference counting has been implemented on many handle based classes. GDI+ graphics has been implemented in both single and double byte and is an improvement over the vendor's interface. High performance Retained Graphics has been added. All in all, if you want to program Windows in C++, I++ is a big improvement over the vendor's macro based C interface. Additionally, you get the world's best C++ Collection Class Library for use in general purpose programming.

Getting Started

To begin programming with i++ or Win+, a compiler must first be installed on the machine. The currently supported compiler is Visual Studio.

After Visual Studio has been Installed

Once a compiler has been installed on the machine, the samples supplied with the system may be compiled, linked and run.These samples may be built using the supplied projects. The projects may be found in subdirectories of \Win\Projects shown in the table below.

Directory Description
\Win\Projects\C The samples for the Win+ Guide.
\Win\Projects\C++ The samples for the I++ Guide.
\Win\Projects\Guide The samples for the C++ Guide.
\Win\Projects\Trees The samples for the C++ Standard Library Guide.

Email Address for the I++ Product

mail@BenedictBede.com