2018年4月25日 星期三

捕捉DOS輸出



Thundax Output 


Кодировка из Win в DOS и из DOS в Win в Delphi 2010 
URL
google

function WinToDos(ASource: String): AnsiString;
var
Ch: PAnsiChar;
begin
Ch := AnsiStrAlloc(Length(ASource) + 1);
CharToOem(PChar(ASource), Ch);
Result := StrPas(Ch);
StrDispose(Ch)
end;

procedure WritelnDos(ASource: String);
begin
Writeln(WinToDos(ASource));
end;
function DosToWin(ASource: AnsiString): AnsiString;
var
Ch: PAnsiChar;
begin
Ch := AnsiStrAlloc(Length(ASource) + 1);
OemToAnsi(PAnsiChar(ASource), Ch);
Result := StrPas(Ch);
StrDispose(Ch)
end;

function DosToWin(ASource: AnsiString): String;
var
Ch: PChar;
begin
Ch := StrAlloc(Length(ASource) + 1);
OemToChar(PAnsiChar(ASource), Ch);
Result := StrPas(Ch);
StrDispose(Ch)
end;


function AsciiToAnsi(AsciiStr: string): string;
var AnsiStr: string;
begin
SetLength(AnsiStr, Length(AsciiStr));
if Length(AsciiStr) > 0 then OemToChar(PChar(AsciiStr), PChar(AnsiStr));
AsciiToAnsi:= AnsiStr;
end;

function AnsiToAscii(AnsiStr: string): string;
var AsciiStr: string;
begin
SetLength(AsciiStr, Length(AnsiStr));
if Length(AnsiStr) > 0 then CharToOem(PChar(AnsiStr), PChar(AsciiStr));
AnsiToAscii:= AsciiStr;
end;

取得系統時間 效能量測

http://codingdelphi.blogspot.tw
Win32 Performance Measurement Options


The five Win32 timing functions provided by the base API (as implemented in KERNEL32.dll) are

GetTickCount,
GetSystemTime()
GetSystemTimeAsFileTime()
QueryPerformanceCounter(),
GetThreadTimes()
GetProcessTimes()
timeGetTime()

References
Java 2 Performance and Idiom Guide, Craig Larman & Rhett Guthrie, Prentice-Hall PTR, 2000.
More Effective C++, Scott Meyers, Addison-Wesley, 1996.
More Exceptional C++, Herb Sutter, Addison-Wesley, 2002.

rtc base timeer timegettime setwaitabletimer ... 最後一頁

GetTickCount function
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724408%28v=vs.85%29.aspx


https://msdn.microsoft.com/en-us/library/windows/desktop/ms724411%28v=vs.85%29.aspx
timeGetTime function
https://msdn.microsoft.com/en-us/library/dd757629.aspx
ntquerytimerresolution NtSetTimerResolution
NtQuerySystemInformation function
https://msdn.microsoft.com/zh-tw/library/windows/desktop/ms724509(v=vs.85).aspx
Articles » Languages » C / C++ Language » General Timers Tutorial
https://www.codeproject.com/Articles/1236/WebControls/?fid=2345&df=90&mpp=25&sort=Position&view=Normal&spc=Relaxed&fr=101&prof=True




Acquiring high-resolution time stamps
QueryPerformanceCounter (QPC)
System.Diagnostics.Stopwatch
QueryPerformanceFrequency
Timestamp Cycle Counter (TSC) - Intel® Developer ... 64-bit register present on all x86 processors since the Pentium.