lab4_pw
-
Upload
dumitru-plamadeala -
Category
Documents
-
view
221 -
download
0
Transcript of lab4_pw
-
8/12/2019 lab4_pw
1/4
Referat
Lucrarea de laborator #4
Tema: Ceasul.
Efectuat de studenta gr.FI-031 :Cepaliga Olga
Verificat de prof.Calin Rostislav
Chiinu 2006
-
8/12/2019 lab4_pw
2/4
Scopul lucrarii: De creat un program care realizeaza ceasul .
Codul programului#include #include
#define TIMER 1000#define IDC_TIMER 100
cha s!"uffe M$%_&$T'()cha s!Time*o mat (+,hh-mm-ss,)cha Cif e (+/,1 , ,1, , , ,2, ,3, ,4, ,5, ,6, ,7, ,8, ,10, ,11,9)
void TimeTo&oint:int RECT; & I=T; )void T ansfo mTo?c :RECT ; c & I=T ;@t )
ARE?BAT C$AA"$C nd& oc:' =D h nd BI=T uMs &$R$M w&a am A&$R$M l&a am )
int I=$&I inMain:'I=?T$=CE hInstance 'I=?T$=CE h& evInstance A&?TR l@CmdAine int iCmd?how/
static cha s!$@@=ame ( + ,AaFo ato ul 3,) ' =D hwnd) M?G ms ) =DCA$??E% wndclass)
wndclass.cF?i!e + si!eof :wndclass ) wndclass.stHle + C?_'REDR$ C?_JREDR$ ) wndclass.l@fn nd& oc + nd& oc ) wndclass.cFClsEKt a + 0 )
wndclass.cF ndEKt a + 0 ) wndclass.hInstance + hInstance ) wndclass.hIcon + AoadIcon :=BAA IDI_$&&AIC$TI = ) wndclass.hCu so + AoadCu so :=BAA IDC_$RR ) wndclass.hF "acL ound + :'"RB?' Get?tocL F ect : 'ITE_"RB?' ) wndclass.l@s!Menu=ame + =BAA ) wndclass.l@s!Class=ame + s!$@@=ame ) wndclass.hIcon?m + AoadIcon :=BAA IDI_$&&AIC$TI = ) Re iste ClassEK :;wndclass ) hwnd + C eate indow :s!$@@=ame s!$@@=ame ?_ JERA$&&ED I=D 40 40 300 300
=BAA =BAA hInstance =BAA ) ?how indow :hwnd iCmd?how ) B@date indow :hwnd )
while :GetMessa e :;ms =BAA 0 0 >0 /T anslateMessa e :;ms )
Dis@atchMessa e :;ms ) 9 etu n ms .w&a am )9
ARE?BAT C$AA"$C nd& oc:' =D h nd BI=T iMs &$R$M w&a am A&$R$M l&a am/ &$I=T?TRBCT @s) RECT ect c cs) 'DC hdc hmemdc)
'"ITM$& hFitma@) ?N?TEMTIME st) & I=T @t) int i)
-
8/12/2019 lab4_pw
3/4
switch :iMs/
case M_CRE$TE-?etTime :h nd IDC_TIMER TIMER =BAA )
F eaL)case M_TIMER-
InvalidateRect:h nd =BAA =BAA )
F eaL)case M_?IOE-InvalidateRect:h nd =BAA =BAA )
F eaL)case M_&$I=T-
hdc+"e in&aint:h nd ;@s )GetClientRect:h nd ; c )cs+ c)hmemdc+C eateCom@atiFleDC:hdc )hFitma@+C eateCom@atiFle"itma@:hdc c. i ht c.Fottom )?elect F ect:hmemdc hFitma@ )?elect F ect:hmemdc C eate?olid" ush:Get?HsColo :C A R_ I=D )*illRect:hmemdc ; c C eate?olid" ush:Get?HsColo :C A R_ I=D )
GetAocalTime:;st )?elect F ect:hmemdc C eate?olid" ush:RG":1 7 2 4 )?elect F ect:hmemdc C eate&en:&?_? AID 2 10000 )Rectan le:hmemdc c.left c.to@ c. i ht c.Fottom )
?elect F ect:hmemdc C eate&en:&?_? AID 14 110010 )cs. i ht +0.5) cs.Fottom +0.5)TimeTo&oint:st.w'ou 50 50Pst.wMinute 50Pst.w?econd cs @t )MoveToEK:hmemdc c. i htQ c.FottomQ =BAA )T ansfo mTo?c : c @t )AineTo:hmemdc @t.K @t.H )
?elect F ect:hmemdc C eate&en:&?_? AID 7 401100 )cs. i ht +1.14) cs.Fottom +1.14)TimeTo&oint:st.wMinute 50 1 Pst.w?econd 1 cs @t )MoveToEK:hmemdc c. i htQ c.FottomQ =BAA )T ansfo mTo?c : c @t )AineTo:hmemdc @t.K @t.H )
?elect F ect:hmemdc C eate&en:&?_? AID 2 405011 )cs. i ht +1.14) cs.Fottom +1.14)TimeTo&oint:st.w?econd 50 1 cs @t )MoveToEK:hmemdc c. i htQ c.FottomQ =BAA )T ansfo mTo?c : c @t )AineTo:hmemdc @t.K @t.H )
cs. i ht +1. ) cs.Fottom +1. )?et"LColo :hmemdc 101100 )fo :i+0)i
-
8/12/2019 lab4_pw
4/4
"it"lt:hdc 0 0 c. i ht c.Fottom hmemdc 0 0 ?RCC &N )DeleteDC:hmemdc )Delete F ect:hFitma@ )End&aint:h nd ;@s )
F eaL ) case M_DE?TR N- illTime :h nd IDC_TIMER )
&ostSuitMessa e:0 ) F eaL)default -
etu n Def indow& oc :h nd iMs w&a am l&a am )
9 etu n 0)9
void TimeTo&oint:int t RECT ; & I=T ;@t/ @t.K+: . i ht .left sin: 2.13 tQ:50 50 1 Q ) @t.H+: .Fottom .to@ cos: 2.13 tQ:50 50 1 Q )
9
void T ansfo mTo?c :RECT ; c & I=T ;@t/ @t.KP+: c. i ht c.left Q ) @t.H+: c.Fottom c.to@ Q @t.H)9
Rezultatul obtinut
Concluzie: In aceasta luc a e de laFo ato ne am familia i!at cu functiile le ate cu time ulsistemului de o@e a e. $m a@licat functiile GDI utili!ate in laFo ato ul .