当前位置:主页>仓库管理软件> 列表

谁有写过使用API函数代替定时器控件的功能 找服装进销存

库存管理软件版1楼: 谁有写过使用API函数代替定时器控件的功能

2楼: 看看定时器里面的功能
用的是API和消息
那出来不知道能不能满足你的要求
FWindowHandle := Classes.AllocateHWnd(WndProc);
首先你需要一个接受消息的句柄
procedure TTimer.WndProc(var Msg: TMessage);
begin
with Msg do
if Msg = WM_TIMER then
try
Timer;
except
Application.HandleException(Self);
end
else
Result := DefWindowProc(FWindowHandle, Msg, wParam, lParam);
end;
和一个处理消息的过程
WM_TIMER = $0113;
来处理这个消息
function SetTimer(hWnd: HWND; nIDEvent, uElapse: UINT;
lpTimerFunc: TFNTimerProc): UINT; stdcall;
.
.
.
相关的API自己查查吧 如服装进销存

3楼: procedure OneMilliSecondProc(uTimerID: UINT; uMsg: UINT; dwUser: DWORD; dw1:
DWORD; dw2: DWORD);
begin
Form1.Label1.Caption := IntToStr(timeGetTime);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
wTimerRes_1ms, wAccuracy: UINT;

begin
wTimerRes_1ms := 10;
wAccuracy := 0;
timeSetEvent(wTimerRes_1ms, wAccuracy,
@OneMilliSecondProc, //回调函数[/red]
1000, //用户自传送到回调函数的数据
TIME_PERIODIC);
end;

4楼: 用GetTickCount 它的功能是获得系统自从启动到现在所经过的毫秒数,这样很精确

5楼: var
lTimerId:integer=0;

procedure timer();
begin
//你的代码
end;

要先执行这句
lTimerId:=SetTimer(0,0,1000,@timer);//1000为一秒

6楼: 多人接受答案了。