|
HexString
|
|
[incepatori][Concurs 4]Uptime, Iul 10, 2007, 15:55
|
|
Vreau un program care sa arate Uptimeul Windows-ului : Ora:Minute:Secunde (si milisecunde), EXE-urile se vor posta aici, sursele se vor trimite in privat la mine !!! Cine mai pune altceva pe program decat ce am cerut nu va fii luat in considerare!
Va conta, daca faceti sa arate si milisecundele! Si cat de ordonat si citet e codul sursa!
Concursul tine pana vineri seara, la ora 12 voi pune votarea, si voi face un post cu sursele fiecaruia, va rog sa tineti cont cand votati de ceea ce am cerut !
INAINTE SA VOTATI VA ROG SA VA UITAT LA SURSE!!!
Acum puteti comenta programele, si acest concurs in acest topic!
|
|
|
|
|
Memorat
|
|
|
|
tot_zeu
 DeconectatMesaje: 152
|
|
[incepatori][Concurs 4]Uptime, Iul 11, 2007, 17:10
|
|
|
|
|
|
|
Memorat
|
|
|
|
|
DarkByte
|
|
[incepatori][Concurs 4]Uptime, Iul 12, 2007, 00:52
|
|
|
|
|
|
|
Memorat
|
|
|
|
|
AdyX
|
|
[incepatori][Concurs 4]Uptime, Iul 12, 2007, 09:19
|
|
|
|
|
|
|
Memorat
|
|
|
|
|
emj
|
|
[incepatori][Concurs 4]Uptime, Iul 12, 2007, 23:43
|
|
Descalificat
|
|
|
|
|
Memorat
|
|
|
|
|
HexString
|
|
[incepatori][Concurs 4]Uptime, Iul 13, 2007, 00:57
|
|
Emj este descalificat pentru ca a copiat programul (bineinteles nu in totalitate). $getdll = DllCall("kernel32.dll", "long", "GetTickCount") $ticksSinceBoot = $getdll[0] Aceste randuri sunt din programul lui, iar searchu-ul pe AutoItScript-Forum m-a dus la aceste randuri : $aTSB = DllCall ("kernel32.dll", "long", "GetTickCount") $ticksSinceBoot = $aTSB[0] Link catre cererea lui Emj pentru a ii se face programul : http://www.autoitscript.com/forum/index.php?s=&showtopic=49350&view=findpost&p=371869 Mai multe comentarii la OffTopic Concursuri.
|
|
|
|
|
Memorat
|
|
|
|
Xladhenian
 DeconectatMesaje: 47
|
|
[incepatori][Concurs 4]Uptime, Iul 13, 2007, 08:51
|
|
|
|
|
|
|
Memorat
|
|
|
|
|
DarkByte
|
|
[incepatori][Concurs 4]Uptime, Iul 14, 2007, 01:48
|
|
Okey-dokey, il asteptam pe HexString sa ne arate sursele sa putem vota.
|
|
|
|
|
Memorat
|
|
|
|
|
HexString
|
|
[incepatori][Concurs 4]Uptime, Iul 14, 2007, 09:00
|
|
SURSE !!! Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Function Timptrecut() As String Const mili = 0.1 Dim Osecunda As Long Osecunda = GetTickCount 1000 Timptrecut = Format$((Osecunda 3600) Mod 24, "00 ore ") & Format$((Osecunda Mod 3600) 60, "00 minute ") & Format$((Osecunda Mod 60), "00 secunde ") End Function
Private Sub Timer1_Timer() Label1 = Timptrecut() End Sub
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;
type TForm1 = class(TForm) Label1: TLabel; UpLabel: TLabel; Timer1: TTimer; procedure Timer1Timer(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1; start : boolean = false;
implementation
{$R *.dfm}
function Pad(x:byte; s:string):string; {functie care pune 0-uri in stanga numarului} var st:string; {daca numarul nu are minim X cifre} begin St := S; While length(st) < x Do St := '0' + St; Result := St; end;
function UpTime: string; const mss : Integer = 1000; {milisecunde pe secunda} msm : Integer = 1000 * 60; {milisecunde pe minut} msh : Integer = 1000 * 60 * 60; {milisecunde pe ora} msd : Integer = 1000 * 60 * 60 * 24; {milisecunde pe zi} trm : array[1..5] of string = ('mili','sec','min','ore','zile'); {terminatii} var t : Longword; mili : array[1..5]of integer; St : string; begin t := GetTickCount;
mili[5] := t div msd; Dec(t, mili[5] * msd);
mili[4] := t div msh; Dec(t, mili[4] * msh);
mili[3] := t div msm; Dec(t, mili[3] * msm);
mili[2] := t div mss; Dec(t, mili[2] * mss);
mili[1] := t;
Result := '';
For t:=5 downto 1 Do Begin If (not Start) and (mili[t]=0) Then Continue Else Start := True; If t = 1 Then St := St + ' ' + Pad(3, IntToStr(mili[1])) + ' ' + trm[1] Else St := St + ' ' + Pad(2, IntToStr(mili[t])) + ' ' + trm[t]; End; Start := False; Result := St; end;
procedure TForm1.Timer1Timer(Sender: TObject); begin UpLabel.Caption := UpTime; end;
procedure TForm1.FormCreate(Sender: TObject); begin Timer1.Interval := 7; Timer1.Enabled := True; end;
end.
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;
type TForm1 = class(TForm) Timer1: TTimer; Label1: TLabel; Label2: TLabel; procedure Timer1Timer(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject); var a: int64; h, m, s, ms: longword; begin Label2.Caption:=''; a:=GetTickCount; ms:=a mod 1000; a:=a div 1000; s:=a mod 60; a:=a div 60; m:=a mod 60; a:=a div 60; h:=a; if h<>0 then Label2.Caption:=IntToStr(h)+' hours '; if m<10 then Label2.Caption:=Label2.Caption+'0'; Label2.Caption:=Label2.Caption+IntToStr(m)+' minutes '; if s<10 then Label2.Caption:=Label2.Caption+'0'; Label2.Caption:=Label2.Caption+IntToStr(s)+' seconds '; if ms<10 then Label2.Caption:=Label2.Caption+'0'; if ms<100 then Label2.Caption:=Label2.Caption+'0'; Label2.Caption:=Label2.Caption+IntToStr(ms)+' miliseconds'; end;
end.
Unit WindowsUpTimeUnit;
Interface
Uses Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs, ExtCtrls;
Type TWindowsUpTimeForm = Class(TForm) Timer1:TTimer; Procedure FormCanResize(Sender:TObject;Var NewWidth,NewHeight:Integer;Var Resize:Boolean); Procedure Timer1Timer(Sender:TObject); Private Public End;
Var WindowsUpTimeForm:TWindowsUpTimeForm;
Implementation
{$R *.dfm}
Procedure TWindowsUpTimeForm.FormCanResize(Sender:TObject;Var NewWidth,NewHeight:Integer;Var Resize:Boolean); Begin Resize := False; End;
Procedure TWindowsUpTimeForm.Timer1Timer(Sender:TObject); Var T:DWord; w,d,h,m,s,ms:Word; Txt:String; Begin T := GetTickCount; ms := T MOD 1000; T := T DIV 1000; s := T MOD 60; T := T DIV 60; m := T MOD 60; T := T DIV 60; h := T MOD 24; T := T DIV 24; d := T MOD 7; T := T DIV 7; w := T; Txt := 'Windows Uptime : ' + IntToStr(w) + ' week'; If (w <> 1) Then Begin Txt := Txt + 's'; End; Txt := Txt + ', ' + IntToStr(d) + ' day'; If (d <> 1) Then Begin Txt := Txt + 's'; End; Txt := Txt + ', ' + IntToStr(h) + ' hour'; If (h <> 1) Then Begin Txt := Txt + 's'; End; Txt := Txt + ', ' + IntToStr(m) + ' minute'; If (m <> 1) Then Begin Txt := Txt + 's'; End; Txt := Txt + ', ' + IntToStr(s) + ' second'; If (s <> 1) Then Begin Txt := Txt + 's'; End; Txt := Txt + ', ' + IntToStr(ms) + ' milisecond'; If (ms <> 1) Then Begin Txt := Txt + 's'; End; Txt := Txt + '.'; Caption := Txt; End;
End.
Dupa testele facute de mine doar programul lui DarkByte a aratat si zilele  ...
|
|
|
|
|
Memorat
|
|
|
|
|
AdyX
|
|
[incepatori][Concurs 4]Uptime, Iul 14, 2007, 10:40
|
|
Deci cum am gandit: tot_zeu, dragut program, ocupa foarte putin, dar nu arata milisecundele DarkByte, no comment, s-a luat dupa mine Xladhenian, interesanta ideea sa pui timpul in bara de titlu DarkByte si Xladhenian ar fi la egalitate dupa parerea mea, dar votul meu merge catre DarkByte, pentru ca arata si zilele si ca...e DELPHI 
|
|
|
|
|
Memorat
|
|
|
|
|
HexString
|
|
[incepatori][Concurs 4]Uptime, Iul 14, 2007, 10:54
|
|
AdyX a trimis DarkByte mai repede deci tu mi-ai spart contu te-ai uitat in prv si te-ai luat dupa el  ... Joking  .
|
|
|
|
|
Memorat
|
|
|
|
|
AdyX
|
|
[incepatori][Concurs 4]Uptime, Iul 14, 2007, 11:02
|
|
Joking?..Asa s-a intamplat...m-ai prins  PS: Uite ca ii dam treaba lui 3Nigma
|
|
|
|
|
Memorat
|
|
|
|
|
DarkByte
|
|
[incepatori][Concurs 4]Uptime, Iul 14, 2007, 14:11
|
|
Sunt 9 voturi si doar AdyX a explicat de ce a votat cum a votat. Ii asteptam pe restul sa se explice, altfel vom reincepe poll-ul. Cititi postul initial al lui HexString, verificati ce anume cere, postati considerentele voastre si votati in consecinta. Bafta P.S. AdyX, sry ... o sa votez cu Xladhenian fiindca mi se pare cel mai complet - printre altele, 2 chestii - se ocupa si de saptamani + ca e tot in Delphi 
|
|
|
|
|
Memorat
|
|
|
|
|
Teal
|
|
[incepatori][Concurs 4]Uptime, Iul 14, 2007, 18:36
|
|
nu aveam voie sa particip. dar va arat ce am facut. ca mi-a placut ideea. http://rapidshare.com/files/42903478/uptime.rarCOD SURSA uptime.au3 - pentru uptime.exe #include
$form=GUICreate("Windows Uptime - BY TE4L", 510, 395) GUICtrlSetBkColor($form, 0x191919)
GUICtrlCreatePic("bg.jpg", 0, 0, 0, 0) $dll = DllOpen("uptime.dll") $mili_a = DllCall($dll, "uint", "GetUptime")
GUISetFont (30, 400, 1, "Verdana")
$days = GUICtrlCreateInput(-1,8,150,96,90,$ES_READONLY) $hours = GUICtrlCreateInput(-1,107,150,96,90,$ES_READONLY) $min = GUICtrlCreateInput(-1,207,150,96,90,$ES_READONLY) $sec = GUICtrlCreateInput(-1,307,150,96,90,$ES_READONLY) $miliseconds = GUICtrlCreateInput(-1,406,150,96,90,$ES_READONLY)
GUICtrlSetBkColor($days, 0x191919) GUICtrlSetBkColor($hours, 0x191919) GUICtrlSetBkColor($min, 0x191919) GUICtrlSetBkColor($sec, 0x191919) GUICtrlSetBkColor($miliseconds, 0x191919)
GUICtrlSetColor($days,0xFFFFFF) GUICtrlSetColor($hours,0xFFFFFF) GUICtrlSetColor($min,0xFFFFFF) GUICtrlSetColor($sec,0xFFFFFF) GUICtrlSetColor($miliseconds,0xFFFFFF)
GUISetState(@SW_SHOW)
$d =86400000 $h =3600000 $m =60000 $s =1000
While 1 $mili_a = DllCall($dll, "uint", "GetUptime") $mili=Get($mili_a[0],$d) If $mili > GUICtrlRead($days) Then GUICtrlSetData($days, $mili) EndIf $mili=$mili_a[0]-GUICtrlRead($days)*$d $mili=Get($mili,$h) If $mili > GUICtrlRead($hours) OR $mili=24 Then GUICtrlSetData($hours, $mili) EndIf $mili=$mili_a[0]-GUICtrlRead($days)*$d-GUICtrlRead($hours)*$h $mili=Get($mili,$m) If $mili > GUICtrlRead($min) OR $mili=0 Then GUICtrlSetData($min, $mili) EndIf $mili=$mili_a[0]-GUICtrlRead($days)*$d-GUICtrlRead($hours)*$h-GUICtrlRead($min)*$m $mili=Get($mili,$s) If $mili > GUICtrlRead($sec) OR $mili=0 Then GUICtrlSetData($sec, $mili) EndIf $mili=$mili_a[0]-GUICtrlRead($days)*$d-GUICtrlRead($hours)*$h-GUICtrlRead($min)*$m-GUICtrlRead($sec)*$s GUICtrlSetData($miliseconds, $mili) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then DllClose($dll) ExitLoop EndIf WEnd
Func Get($mili,$imp) Return Int($mili/$imp) EndFunc uptime.cpp - pentru uptime.dll #include extern "C" __declspec(dllexport) unsigned long GetUptime() { return GetTickCount(); } BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason,LPVOID reserved) { return true; } Si nu aveti nevoie de psd la poza. As fi facut si un icon. Dar nu aveam idei  . As fi castigat?  ^:angel:^
|
|
|
|
|
Memorat
|
 "Not only the wisdom of centuries — also their madness breaketh out in us. Dangerous is it to be an heir." Nietzsche
|
|
|
|
DarkByte
|
|
[incepatori][Concurs 4]Uptime, Iul 14, 2007, 18:54
|
|
Sunt 9 voturi si doar AdyX a explicat de ce a votat cum a votat. Ii asteptam pe restul sa se explice, altfel vom reincepe poll-ul.
Cititi postul initial al lui HexString, verificati ce anume cere, postati considerentele voastre si votati in consecinta.
Sper ca ati inteles ca poll-ul va fi refacut daca nu va explicati ce v-a facut sa votati cu X sau Y.
|
|
|
|
|
Memorat
|
|
|
|
|
|
|