uuindouus uershon 20


uuindouus is aa 16 caracter (hecsadecinnal) interphaas phor prohgranning uuindouus in uisiooal stioodeeoh. it upgrades the Win32 api. noh heders ar reecuuiird phor uuindouus too phuncshon - the interphaas is supliid as aa nunnber ou .net asennblees.

spesiphiing constants too bee intellisense auuair

consider the stiils phor uuindouus, as dephiind in WinUser.h, shouun belouu.

/*
 * 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 ar dephiind as nnacrohs, uuich hau glohbal scohp. too phasilitaat intellisense selecshon, thees constants hau been redephiind in the naannspaas uuindouus as shouun belouu.

    public eenioonneraashon clahs_stiil
    {
        uertical_reedrauu = 0x0001,
        horisontal_reedrauu = 0x0002,
        cee_conuert = 0x0004,
        dubl_clics = 0x0008,
        ouun_deeuiis_contecst = 0x0020,
        clahs_deeuiis_contecst = 0x0040,
        pairent_deeuiis_contecst = 0x0080,
        no_cee_conuert = 0x0100,
        no_clohs = 0x0200,
        saau_bits = 0x0800,
        aliin_cliient = 0x1000,
        aliin_uuindouu = 0x2000,
        glohbal_clahs = 0x4000,
        inne = 0x00010000,
        drop_shadouu = 0x00020000
    }

the WS_ preephics has been reeplaasd uuith the eenioonneraashon clahs naann stiil. too repher too the popup stiil we ioos stiil::popup. uuhen iou tiip stiil:: in uisiooal stioodeeoh, it actiuaats the intellisense dephinishon ou uuindouu stiils. bii reepeeting this logic nnanee tiinns, iou ariiu at an intellisense dephinishon ou uuindouus prohgranning. anuther ecsannpl is buton stiils, present in WinUser.h.

/*
 * buton controhl stiils
 */
#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

uuindouus conuerts this too the pholouuing.

   public eenioonneraashon buton_stiil
    {
        push_buton = 0x0000,
        push_buton_dephalt = 0x0001,
        chec_bocs = 0x0002,
        ortoh_checbocs = 0x0003,
        raadeeoh_buton = 0x0004,
        three_staat = 0x0005,
        ortoh_three_staat = 0x0006,
        groop_bocs = 0x0007,
        iooser_buton = 0x0008,
        ortoh_raadeeoh_buton = 0x0009,
        ouuner_drauu = 0x000b,
        tecst_lepht = 0x0020,
        tecst = 0x0000,
        iicon = 0x0040,
        bitnnap = 0x0080,
        lepht = 0x0100,
        riit = 0x0200,
        senter = 0x0300,
        top = 0x0400,
        botonn = 0x0800,
        senter_uertical = 0x0c00,
        push_liic = 0x1000,
        nnulteeliin = 0x2000,
        nohtiphii = 0x4000,
        phlat = 0x8000,
        buton_riit = tecst_lepht
    }

uuhen prohgranning in uisiooal stioodeeoh, selecshon ou thees stiils nnaa bee achieued bii tiping buton_stiil:: uuhairbi iou ar pronnpted too select aa stiil. in eech caas, the sinnplest posibl naann is chosen and the eenioonneraators ecsist in thair sinnplest phornn. thus tuning uuindouus prohgranning phor intellisense leeds too aa iooneec, optinnunn ansuuer, uuich is uuindouus. the alternaatiu is Win32, uuich has thousands ou nnacrohs in the glohbal naann spaas. thus uuindouus optinnises uuindouus prohgranning phor intellisense tecnologee. this essentiorli brings Win32 up too daat (in the phornn ou uuin+).

the constants .net asennblee uuindouus.constants.dll has been reriten phron c++ too c#. thus the constants cernel ou this nioo operating sistenn is nouu in c#.

sinnpleephiing the Win32 api

constants asiid (uuindouus.constants.dll), uuin+ is aa nnuch cleener dephinishon ou the operating sistenn. please consider the declaraashon ou the phuncshon CreateWindowEx phouund in WinUser.h and shouun belouu.

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

noht that too apis ar declaird and nnacrohs ar ioosd too suuich betuueen the too. in uuin+ this declaraashon rediooses too aa singl phuncshon declaraashon shouun belouu. this phuncshon is in the clahs uuin uuich reesiids in the naannspaas uuindouus. too obtaan acses, the .net asennblee uuindouus.uuinplus nnust bee repherensd in uisiooal stioodeeoh.

static hairndl creeaat_uuindouu(unsigned ecstended,
                                string^ clahsnaann,
                                string^ tiitl,
                                unsigned stiil,
                                int ecs,
                                int uuii,
                                int uuidth,
                                int hiit,
                                hairndl pairent,
                                hairndl nnenioo,
                                hairndl nnodiool,
                                hairndl paranneters);

the daatatiip string is aa iooneecohd string. this nneens that the singl declaraashon reeplaases the diooal declaraashon phouund in WinUser.h. noht that the api creeaat_uuindouu shouun abuu is orlsoh checd phor corectnes; as ar orl uuindouus uuin+ apis. this nneens that uuhen cohd is ported intoo uuin+, it is checd and deebugd. aplicaashons riten too this api ar nnuch nnor solid.

aduansd graphics (gdi+)

aduansd graphics (gdi+) has been inclooded in uershon 10. uuindouus has aa graphics clahs uuich has been innproued bii ecssepshons. noh longer ar statuses returnd on phuncshon corls; rarther, the nnethods throuu ecssepshons uuhen aa non-sero status is encouunterd. orlsoh nioo too uershon 10 is aa reetaand gdi+ clahs corled r2. this is aa nnagor step phoruuard in that nouu the aduansd graphics sistenn can been edited. os/2 ohnlee had integer reetaand graphics; uuhairas the clahs r2 is both integer and phloating point reetaand graphics.

getting started

too beegin prohgranning uuith uuindouus or uuin+, aa connpiiler nnust phurst bee instorld on the nnasheen. the curentlee suported connpiiler is uisiooal stioodeeoh.

aphter uisiooal stioodeeoh has been instorld

uuuns aa connpiiler has been instorld on the nnasheen, the sannpls supliid uuith the sistenn nnaa bee connpiild, lincd and run.thees sannpls nnaa bee built ioosing the supliid progects. the progects nnaa bee phouund in subdirectorees ou \uuindouus\progects shouun in the taabl belouu.

directoree descripshon
\uuindouus\progects\i++ c++ sannpls phor the uuin+ giid.
\uuindouus\progects\i# c# sannpls phor the uuin+ giid.