18-06-2010, 10:43 AM
Benhlell كتب :عند اختيار console Appliction من New Item كيف يمكني استدعاء الادوات مثل Indy او Timer
:laugh:
[COLOR="Purple"]يمكنك اضافة الملف المسؤل عنها الى الـ Uses و من ثم استخدامها
لكن اتسائل لماذا تصنع برنامج Console في هذه ِ الحالة ؟؟
الحجم سيصبح كبيرا ً و كأنه تطبيق VCL, إلا اذا كنت تعرف بالبرمجة جيدا ً

---
بشأن الـ Timer انضر هذا ربما يفيدك :
كود :
program Project2;
{$APPTYPE CONSOLE}
uses
Windows, SysUtils, Messages;
procedure MyTimer(hWnd: HWND; uMsg: Integer; idEvent: Integer; dwTime: Integer); stdcall;
begin
writeln('Timer Event');
end;
procedure ProcessMessages;
var
Msg: TMsg;
begin
while PeekMessage(Msg, 0, 0, 0, PM_REMOVE) do begin
if Msg.Message <> WM_QUIT then begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end else
exit;
end;
end;
var
s: TDateTime;
id: uint;
begin
id := SetTimer(0, 1, 1000, @MyTimer);
s := Now;
repeat
Sleep(100);
ProcessMessages; // <-- try it without this line
until Now - s > EncodeTime(0, 0, 10, 0);
KillTimer(0, id);
end.سلام[/COLOR]

