Sie sind auf Seite 1von 2

Chng1: TOMTNGDNGTRONGC++

I. ThitkvtomtngdngtrongC++
1) KhingVC++:ChnStart>chnMicrosoftVisualC++
2) Tomtngdngmi:
ChnmenuFile>New>XuthincasNew,TachnthProjects,Sau
thchinydbabcsau:
Bc1:ChnMFCAppWizard(exe)
Bc2:XcnhthmcchangdngtrongmcLocation
Bc3:ttnchongdngtrongmcProjectName

> Xut hin ca s MFC AppWizard cho php ta chn mt trong ba Kiu
giao din ca ng dng l Single Document, Multiple Documents v Dialog
Based.
3) Dchccthnhphntrongmtngdng:chnRebuildAll
4) Thcthichngtrnh:ChnmenuBuild>chnExecute
II. TmhiumitrngphttrincaC++
1) Mmtngdngtnti:ChnmenuFile>chnOpenWorkspace>chntn
filecangdng(thngcphnmrng.dsw) >chnOpen.
2) CasWorkspace: thngcbathnhphnClassView,ResourceView,vFileView
ClassView:dnghinthttccclpctrongngdng
ResourceView:dnghinthdanhschcctinguynctrongngdng
nh:Dialog,Icon,Menu,Bitmap,
FileView:dnghinthdanhschccfilectrongngdng
III. Tomtngdngngin
Vd:TomtngdngKiuDialogxutHpthngbochacuChaoban!.
1) ButtonControl:dngthchinmtlnh nginbngcchClickvon.
Lp CButton: c dn xut t cc lp sau: CObject > CCmdTarget >
CWnd>CDialog>CButton.
itngnycskinquantrnglClick
tccthuctnhchoButton:chnButtonControl >nhnntphi,vchn
Properties
Mi Control c mt ch s ID, v ta dng n thc hin cc tc ng ln
Control.
2) XuthpthngbotadnghmMessageBox.
HmctipungAfx:
intAfxMessageBox(
LPCTSTRlpszText,
UINTnType=MB_OK,
UINTnIDHelp=0

TronglpCWnd:
intMessageBox(
LPCTSTRlpszText,
LPCTSTRlpszCaption=NULL,
UINTnType=MB_OK
)

3) CpnhtControlButtontrongqu trnhthcthi:
LpCWnd:
HmGetDlgItem():trvcontrchnmtControl hocmtcascon trongmt
DialoghocmtcaskhccchsnID.
CWnd*GetDlgItem(
intnID
)const
voidGetDlgItem(
intnID,
HWND*phWnd
)const

HmIsWindowVisibled():hmtrvkhc0nucasVisible
BOOLIsWindowVisible()const

HmIsWindowEnabled():Hmtrvkhc0nucasEnable
BOOLIsWindowEnabled()const

Hm ShowWindow(): t trng thi Visible ca ca s (SW_HIDE :n ca


s, SW_SHOW:hincas )
BOOLShowWindow(
intnCmdShow
)

HmEnableWindow():Enableshocdisablesmtcas
BOOLEnableWindow(
BOOLbEnable=TRUE
)

HmSetWindowText():ttiuchomtcas
voidSetWindowText(
LPCTSTRlpszString
)

Hm GetWindowText(): sao chp ni dung tiu ca ca s v cha vo thnh


phnthuckiuchui(LPTSTRhocCString)
intGetWindowText(
LPTSTRlpszStringBuf,
intnMaxCount
)const
voidGetWindowText(
CString&rString
)const

Das könnte Ihnen auch gefallen