uuindouus uershon 20


uuindouus is aa 16 caracter (hecsadecinnal) interphaas phor prohgranning uuindouus in uisiooal stioodeeoh. it upgraads 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 inteleesens 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 inteleesens selecshon, thees constants hau been redephiind in the naannspaas uuindouus as shouun belouu.

  public enum stiil : uint
    {
        uuindouu = 0x00000000,
        popup = 0x80000000,
        chiild = 0x40000000,
        nnininniis = 0x20000000,
        uisibl = 0x10000000,
        disaabld = 0x08000000,
        clip_siblings = 0x04000000,
        clip_children = 0x02000000,
        nnacsinniis = 0x01000000,
        capshon = 0x00c00000,
        border = 0x00800000,
        diialog_phraann = 0x00400000,
        uertical_scrohl = 0x00200000,
        horisontal_scrohl = 0x00100000,
        sistenn_nnenioo = 0x00080000,
        thic_phraann = 0x00040000,
        groop = 0x00020000,
        tabstop = 0x00010000,
        nnacsinniis_bocs = 0x00020000,
        nnininniis_bocs = 0x00010000,

        stairndard = (int)uuindouu |
                     (int)capshon |
                     (int)sistenn_nnenioo |
                     (int)thic_phraann |
                     (int)nnininniis_bocs |
                     (int)nnacsinniis_bocs,

        popup_uuindouu = unchecked((uint)popup) |
                         unchecked((uint)border) |
                         unchecked((uint)sistenn_nnenioo),

        siis_bocs = thic_phraann
    }

the WS_ preephics has been reeplaasd uuith the eenioonneraashon naann stiil. too repher too the popup stiil we ioos stiil.popup. uuhen iou tiip stiil. in uisiooal stioodeeoh, it actiuaats the inteleesens dephinishon ou uuindouu stiils. bii reepeeting this logic nnanee tiinns, iou ariiu at an inteleesens 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 acheeud bii tiping buton_stiil. uuhairbi iou ar pronnpted too select aa stiil. in eech caas, the sinnplest posibl naann is chohsen and the eenioonneraators ecsist in thair sinnplest phornn. thus tuning uuindouus prohgranning phor inteleesens 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 optinniises uuindouus prohgranning phor inteleesens 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#.

sinnpliphiiing 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 nuuidth,
    __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 nuuidth,
    __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(uint ecstended,
                                string clahsnaann,
                                string tiitl,
                                uint 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 inprooud bii ecssepshons. noh longer ar statiooses 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 r_too. this is aa nnagor step phoruuard in that nouu the aduansd graphics sistenn can been edited. os/2 ohnlee had int reetaand graphics; uuhairas the clahs r_too is both int 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 prohgects. the prohgects nnaa bee phouund in subdirectorees ou \uuindouus\prohgects shouun in the taabl belouu.

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