win+


I++ has the programming subsystem - win+. The projects for this book may be found in \iplusplus\samples. This directory contains projects for win+. The subdirectories contain the actual projects. Depending upon which chapter is being studied, the reader should navigate the projects directories to load the project corresponding to the discussion. The chapter that is being discussed needs to be known in advance.

The win+ interface is a modern C/C++ interface for programming windows. It is an Operating System Abstraction Layer. It abstracts the operating system to a C++ Code Layer. This code layer provides an improved interface for programming windows, and it may eventually lead to new, improved operating systems. In the latest release, the code of the layer has been removed and the previous unmanaged definition of I++ dropped, leaving only header files. These headers have some code in them, mainly default constructors and operators. Additionally there is a native string class, which is all inlined. The API is defined in the forwarding layers Layer.lib and LayerAscii.lib. Layer.dll and LayerAscii.dll don't contain any code, just forwarding references to the original windows dlls. So only the inlined code defined in the headers remains - and the headers are standalone. This makes them a candidate for replacing the existing Win32 headers - which are extremely dated and quite ugly.

win+ is packaged using name spaces, and the names chosen for programming identifiers within the names spaces has been carefully thought through. win+ applies corrections to the original Win32 name space. Functions names like GetDC have been expanded to get_device_context. Another example is DefDlgProc, which has been renamed to default_dialog_procedure. Thousands of constants that previously were defined as macros have been redefined as enumerators. For example, in the existing Win32 interface, window styles are defined as follows:

#define WS_OVERLAPPED 0x00000000L
#define WS_POPUP      0x80000000L
#define WS_CHILD      0x40000000L
...

whereas, in i++ and win+, the window styles are part of the structure style - a portion of which is shown below.

struct style
{
 enum
 {
  window            = 0x00000000,
  popup             = 0x80000000,
  child             = 0x40000000,
 ...

Note that macros are part of the preprocessor and have no place in common programming. Macros are of global scope, whereas the enumeration for styles is part of the iplusplus namespace. win+ repositions all of the constants of Win32 in this way. In doing so, all the acronyms (like WS_) are banished. Note that Intellisense is available on all constants using the scope operator. For example, to refer to the Child style the following is used style::Child. When the scope operator is used, Intellisense prompts the user with a list of options. The entire operating system has been restructured (from Version 6 to Version 7) to ensure optimum use of Intellisense.

Additionally, no use is made of terms that:

Notice in the above declaration of window styles, Win32 contains the acronym WS_. This pattern is repeated throughout the Win32 interface, making the entire interface acronymic. win+ undoes by packaging constants in structures. When the constants are defined in structures, the burden of uniqueness is lifted, thereby enabling the prefixes to be dropped. This provides an optimal definition of the windows operating system.

The main unsigned integer data type of Win32 is DWORD (short for double word). In 64 bit windows, a DWORD is 32 bits - a half word. DWORD has its origins in 16 bit windows, where a word was 16 bits and thus a double word was 32 bits. clearly DWORD is a hardware dependent term and the hardware it refers to is twenty years in the past. A DWORD becomes simply an unsigned in win+. So Win32 is hardware dependent and win+ is hardward independent.

The API naming conventions of Win32 are the best portion of the namespace. The API uses a mixed case naming convention with uppercase used to separate words. In win+, the mixed case naming convention has been extended to classes and constants. In Win32, constants are in solid uppercase with words run together (quite ugly). win+ remedies this unsightly code with the mixed case naming convention. The end result is that constants, functions and classes all use the same, consistent naming convention.

name Spaces

The interface of i++ is contained in the name space iplusplus.This leads to win+ code containing the statements:

import iplusplus;
using namespace iplusplus;

The system is contained in the C++ module named iplusplus. This accounts for the import statement, which imports the module. The use of name spaces and the careful selection of elements of the name space lead to the win+ C interface being a modern, clean method of accessing the services of the windows operating system.