Delphi跨平台下的GetTickCount,GetCurrentThreadID

Delphi跨平台下的GetTickCount,GetCurrentThreadID

在Windows下只要uses Windows,就有这两个API可调用GetTickCount,GetCurrentThreadID

如果我们需要跨平台使用这两个函数,就不能仅仅Uses Windows了。

如果需要跨平台使用GetTickCount,可以uses System.Classes,然后使用类方法:TThread.GetTickCount

如果需要跨平台使用GetCurrentThreadID,则仅需引用不同的单元即可:

uses 
{$ifdef MSWINDOWS}
Windows;
{$endif}
{$ifdef POSIX}
Posix.Pthread;
{$endif}

posted @ 2017-03-28 15:26  delphi中间件  阅读(635)  评论(0编辑  收藏  举报