Vodeo Player H.S.N
اولین سورس برنامه نویسی رو در این پست می خوام در اختیارتون بذارم
کار این سورس اینه که فایلهای تصویری رو با هر پسوندی اجرا می کنه.
توصیه می کنم که این سورس رو حتما دانلود کنین.
برای دانلود اینجا را کلیک کنید
آموزش ویژوال بیسیک و مطالب خواندنی
اولین سورس برنامه نویسی رو در این پست می خوام در اختیارتون بذارم
کار این سورس اینه که فایلهای تصویری رو با هر پسوندی اجرا می کنه.
توصیه می کنم که این سورس رو حتما دانلود کنین.
برای دانلود اینجا را کلیک کنید
var
ProgressBarStyle: LongInt;
begin
{create a run progress bar in the status bar}
ProgressBar1 := TProgressBar.Create(StatusBar1);
ProgressBar1.Parent := StatusBar1;
{remove progress bar border}
ProgressBarStyle := GetWindowLong(ProgressBar1.Handle, GWL_EXSTYLE);
ProgressBarStyle := ProgressBarStyle - WS_EX_STATICEDGE;
SetWindowLong(ProgressBar1.Handle, GWL_EXSTYLE, ProgressBarStyle);
{set progress bar position and size - put in Panel[2]}
ProgressBar1.Left := StatusBar1.Panels.Items[0].Width +
StatusBar1.Panels.Items[1].Width + 4;
ProgressBar1.Top := 4;
ProgressBar1.Height := StatusBar1.Height - 6;
ProgressBar1.Width := StatusBar1.Panels.Items[2].Width - 6;
{set range and initial state}
ProgressBar1.Min := 0;
ProgressBar1.Max := 100;
ProgressBar1.Step := 1;
ProgressBar1.Position := 0;
end;
ProgressBar1.free;
procedure TForm1.CopyFileWithProgressBar1(Source, Destination: string);
var
FromF, ToF: file of byte;
Buffer: array[0..4096] of char;
NumRead: integer;
FileLength: longint;
begin
AssignFile(FromF, Source);
reset(FromF);
AssignFile(ToF, Destination);
rewrite(ToF);
FileLength := FileSize(FromF);
with Progressbar1 do
begin
Min := 0;
Max := FileLength;
while FileLength > 0 do
begin
BlockRead(FromF, Buffer[0], SizeOf(Buffer), NumRead);
FileLength := FileLength - NumRead;
BlockWrite(ToF, Buffer[0], NumRead);
Position := Position + NumRead;
end;
CloseFile(FromF);
CloseFile(ToF);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
CopyFileWithProgressBar1('c:\Welcome.exe', 'c:\temp\Welcome.exe');
end;
procedure TForm1.CopyFileWithProgressBar1(Source, Destination: string);
var
FromF, ToF: file of byte;
Buffer: array[0..4096] of char;
NumRead: integer;
FileLength: longint;
t1, t2: DWORD;
maxi: integer;
begin
AssignFile(FromF, Source);
reset(FromF);
AssignFile(ToF, Destination);
rewrite(ToF);
FileLength := FileSize(FromF);
with Progressbar1 do
begin
Min := 0;
Max := FileLength;
t1 := TimeGetTime;
maxi := Max div 4096;
while FileLength > 0 do
begin
BlockRead(FromF, Buffer[0], SizeOf(Buffer), NumRead);
FileLength := FileLength - NumRead;
BlockWrite(ToF, Buffer[0], NumRead);
t2 := TimeGetTime;
Min := Min + 1;
// Show the time in Label1
label1.Caption := FormatFloat('0.00', ((t2 - t1) / min * maxi - t2 + t1) / 100);
Application.ProcessMessages;
Position := Position + NumRead;
end;
CloseFile(FromF);
CloseFile(ToF);
end;
end;
((t2 - t1) / min * maxi - t2 + t1) / 100
type
TMyDBGrid = class(TDBGrid)
published
property OnMouseMove;
end;
procedure WMMouseMove(var Message : TWMMouse); message WM_MOUSEMOVE;
MouseRow : integer;
MouseCol : integer;
procedure TMyDBGrid.WMMouseMove(var Message : TWMMouse);
var
t : TGridCoord;
begin
t := MouseCoord(Message.XPos, Message.YPos);
MouseCol := t.x;
MouseRow := t.y;
inherited;
end;
procedure TForm2.MyDBGrid1MouseMove(Sender: TObject; Shift: TShiftState; X, Y:
Integer);
begin
if (((dgIndicator in MyDBGrid1.Options) and (MyDBGrid1.MouseCol > 0)) or
((not (dgIndicator in MyDBGrid1.Options)) and (MyDBGrid1.MouseCol <> -1)))
and (MyDBGrid1.MouseCol <> OldMouseCol) then begin
OldMouseCol := MyDBGrid1.MouseCol;
if dgIndicator in MyDBGrid1.Options then
MYDBGrid1.Hint := MyDBGrid1.Columns[MyDBGrid1.MouseCol - 1].FieldName
else
MYDBGrid1.Hint := MyDBGrid1.Columns[MyDBGrid1.MouseCol].FieldName;
end;
end;
HintMouseMessage(Control : TControl; var Message : TMessage)
var
r : TMessage;
begin
Application.HintMouseMessage(self, r);
TWMMouse(r).XPos := X;
TWMMouse(r).YPos := Y;
Application.HintMouseMessage(MyDBGrid1, r);
end;