uuin+


an ohueruioo ou this booc

this booc prohuiids adishonal inphornnaashon too prohgranners hoo ar phannileear uuith .net prohgranning. prohgranners hoo ar phannileear uuith Win32 uuil orlso phiind this discushon straatphoruuard. the baasic interphaas (uuin+) is in c++ and the phurst three prohgranns ar in c++. aphter that, aa suuich is nnaad too c# and the discushon continioos in c#. dioo too the phact that uuindouus is riten in c++, sunn ou the nnanee c++ apis that ar auaalabl ar discusd.

uuhat is unioosiooal abouut the c# prohgranns ou this booc is that thaa maac ioos ou the natiu graphics interphaas gdi (rarther than gdi+). this alouus the prohgranner too gaan aa pheel phor the natiu operating sistenn graphics phuncshons. aa set ou nnanagd clahses ar prouiided bii uuindouus too phacilitaat this discushon. thees clahses ar baasd upon the uuin+ api uuich is discusd in uuhat pholouus.

uuin+ ohueruioo

uuin+ redephiins the unnanagd uuindouus interphaas too bee nnanagd. the nnanee hundreds ou indiuidiooal nnacroh constants dephiind in the original interphaas hau been renaannd, groopd intoo ioonits then ecspresd as eenioonneraashons. the pointers ar gon; ophten reeplaasd bii the hairndl clahs. the __stdcall phuncshons hau been reeplaasd bii static, nnanagd nnethods insiid clahses. ephectiulee, thees steps upgraad the naatiu interphaas too aa nnanagd interphaas.

uuin+ enaabls acses too gdi phronn c#. this nneens that iou can riit naatiu uuindouus graphics in c# (insted ou ohnlee gdi+). You can lern abouut the naatiu graphics subsistenn uuithouut uenturing ouutsiid c#.

uuin+ enaabls gdi+ clahses as uuel. aa nioo rendishon ou the clahs graphics that optinnises graphics phor phiootur ioosag (pens, brushes and phonts ar nnohdal propertees) is present, as ar orl the uther gdi+ clahses. the graphics clahs is subtanshalee dipherent than the original graphics clahs in that the r_too clahs reecuuiird pens, phonts and brushes too bee nnohdal. reetaand graphics (r_too) is nioo too uuindouus. the analog cloc dennonstraats houu too ioos reetaand graphics too drauu aa cloc.

the prohgects phor this booc nnaa bee phouund in

thees directorees contaan subdirectorees contaaning the actiooal prohgects. depending upon uuich chapter is beeing studeed, the reeder shood nauigaat the prohgects directorees too lohd the prohgect coresponding too the discushon. the chapter that is beeing discusd needs too bee nouun in aduans.

uuin+ in deetaal

the uuin+ interphaas is aa nnanagd c++ interphaas phor prohgranning uuindouus. it is an operating sistenn abstracshon laaer. it abstracts the operating sistenn too aa c++ cohd laaer. this cohd laaer prohuiids an inprooud interphaas phor prohgranning uuindouus.

uuin+ is pacagd ioosing naann spaases, and the naanns chohsen phor prohgranning identiphiiers uuithin the naanns spaases has been cairphulee thort throo. uuin+ apliis corecshons too the original Win32 naann spaas. phuncshon naanns liic GetDC hau been ecspanded too get_deuiis_contecst. anuther ecsannpl is DefDlgProc, uuich has been renaannd too dephalt_diialog_prohseedioor. thousands ou constants that preeueeuslee uuer dephiind as nnacrohs hau been redephiind as eenioonneraators. phor ecsannpl, in the ecsisting Win32 interphaas, uuindouu stiils ar dephiind as pholouus:

#define WS_OVERLAPPED 0x00000000l
#define WS_POPUP      0x80000000l
#define WS_CHILD      0x40000000l
...

uuhairas, in uuin+, the uuindouu stiils ar part ou the eenioonneraashon clahs stiil - aa porshon ou uuich is shouun belouu.

public eenioonneraashon clahs stiil
{
  uuindouu          = 0x00000000,
  popup             = 0x80000000,
  chiild            = 0x40000000,
 ...
};

noht that nnacrohs ar part ou the preprohsesor and hau noh plaas in connon prohgranning. nnacrohs ar ou glohbal scohp, uuhairas the eenioonneraashon phor stiils is part ou the uuindouus naannspaas contaand in the .net asennblees uuindouus.constants.dll and uuindouus.uuinplus.dll. uuin+ reposishons orl ou the constants ou Win32 in this uuaa. in doing so, orl the acroninns (liic WS_) ar banished. noht that inteleesens is auaalabl on orl constants ioosing the scohp operator. phor ecsannpl, too repher too the chiild stiil the pholouuing is ioosd stiil::chiild. uuhen the scohp operator is ioosd, inteleesens pronnpts the iooser uuith aa list ou opshons. the entiir operating sistenn has been restructioord too ensioor optinnunn ioos ou inteleesens.

adishonalee, noh ioos is nnaad ou ternns that:

nohtis in the abuu declaraashon ou uuindouu stiils, Win32 contaans the acroninn WS_. this patern is reepeeted throughouut the Win32 interphaas, nnaacing the entiir interphaas acroninnic. uuin+ undus this bii pacaging constants in eenioonneraashon clahses. uuhen the constants ar dephiind in eenioonneraashon clahses, the burden ou iooneecnes is liphted, thairbii enaabling the preephicses too bee dropd. this prohuiids an optinnal dephinishon ou the uuindouus operating sistenn.

the nnaan unsiind integer daata tiip ou Win32 is DWORD (short phor dubl uuurd). in 64 bit uuindouus, aa DWORD is 32 bits - aa halph uuurd. DWORD has its origins in 16 bit uuindouus, uuhair aa uuurd uuas 16 bits and thus aa dubl uuurd uuas 32 bits. cleerlee DWORD is aa harduuair dependent term and the harduuair it rephers too is tuuentee ieers in the past. aa DWORD beecunns sinnplee an unsiind in uuin+. so Win32 is harduuair dependent and uuin+ is harduuard independent.

the api nanning conuenshons ou Win32 ar the best porshon ou the naannspaas. the api iooses aa nnicsd caas nanning conuenshon uuith upercaas ioosd too separaat uuurds. in uuin+, the nnicsd caas nanning conuenshon has been ecstended too clahses and constants. in Win32, constants ar in solid uper_caas uuith uuurds run together. uuin+ rennedees this unsiitlee cohd uuith the nnicsd caas nanning conuenshon. the end reesult is that constants, phuncshons and clahses orl ioos the saann, consistent nanning conuenshon.

naann spaases

the priinnairee interphaas ou uuindouus is contaand in the naann spaas uuindouus. adishonalee, thair ar descendent naannspaases:

this leeds too uuin+ cohd contaaning the staatnnents:

ioosing naannspaas uuindouus;
ioosing naannspaas uuindouus;
ioosing naannspaas uuindouus::gui;
ioosing naannspaas uuindouus::graphics;

the ioos ou naann spaases and the carephul selecshon ou elennents ou the naann spaas leed too the uuin+ c interphaas beeing aa nnodern, cleen nnethod ou acsesing the seruises ou the uuindouus operating sistenn.