I++ is the mother of all VMs for Windows. I++ is a Managed C++ Interface for Programming Windows in Visual Studio. It upgrades the Win32 API. No headers are required for I++ to function - the interface is supplied as a number of .Net Assemblies.
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 IPlusPlus::Windows as shown below.
public enum class Style { 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 };
The WS_ prefix has been replaced with the enum class 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.
public enum class ButtonStyle { 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+).
Constants aside (IPlusPlus.Constants.dll), Win+ is a much cleaner definition of the Operating System. 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. This function is in the class Win which resides in the namespace IPlusPlus::Windows. To obtain access, the .Net Assembly IPlusPlus.WinPlus must be referenced in Visual Studio.
static Handle CreateWindow(unsigned Extended, String^ ClassName, String^ Title, unsigned Style, int X, int Y, int Width, int Height, Handle Parent, Handle Menu, Handle Module, Handle Parameters);
The datatype String is a unicode string. This means that the single declaration replaces the dual declaration found in WinUser.h. Note that the API CreateWindow shown above is also checked for correctness; as are all I++ Win+ APIs. This means that when code is ported into Win+, it is checked and debugged. Applications written to this API are much more solid. Win+ has managed to simplify and beautify the declaration of Operating System APIs.
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 is a retained GDI+ class called R2. 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 R2 is both integer and floating point retained graphics.
In recent times, most of the effort of the vendor of the OS has been directed towards C#. I++ fills the gap left by a legacy C system by modernizing the C++ interface as well (as C#). C++ enum classes have been used to gain Intellisense support. No longer does the system rely upon headers; rather, the headers have been transformed into metadata and stored in .Net Assemblies. This is a much more convenient media for accessing the services of the Windows Operating System. It is clear that Win+ is a managed replacement for Win32. If a great deal of investment has already been made in Win32, Win+ offers a convenient upgrade strategy for the code.
To begin programming with i++ or Win+, a compiler must first be installed on the machine. The currently supported compiler is Visual Studio.
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 \IPlusPlus\Projects shown in the table below.
Directory | Description |
\IPlusPlus\Projects\I++ | C++ samples for the Win+ Guide. |
\IPlusPlus\Projects\I# | C# samples for the Win+ Guide. |
benedict@nncnannara.net |
Mail: | Benedict Bede McNamara, 1 Regency Place, Orange, 2800, NSW, Australia. |