- This topic is empty.
-
AuthorPosts
-
April 7, 2002 at 9:46 pm #2706
Michael Cessna
MemberDoes anyone know how to convert the BeginPeakTime and EndPeakTime values in HKEY_LOCAL_MACHINESOFTWAREDelrinaWinFax7.0Peak Times to something meaningful? I have to recreate the “Fax Delivery Options” dialog for our app, and this is the only thing I have left.
Thanks.
Mike
April 7, 2002 at 11:56 pm #4606Anonymous
MemberI’m not 100% sure on this, since I haven’t looked at this for years…but I think this is stored in a format called CAS. And here is code to convert it
This was code from the WinFax PRO 4.0 API, which was used throughout all versions of WinFax ( I believe)
so you probably can figure out the time/date with this algorithm that uses bit shifting‘// CAS date and time formats
‘//
‘//
‘// Given a CAS date (d), convert it back to day,month and year by :
‘//
‘// day = (d & 0x001f)
‘// month = (d & 0x01e0) >> 5
‘// year = ((d & 0xfe00) >> 9) + 1980
‘//
‘//
‘// Given a CAS time (t), convert it back to hour, minute second by:
‘//
‘// hour = (t & 0xf800) >> 11;
‘// minute = (t & 0x07e0) >> 5
‘// sec = (t & 0x001f) << 1;
‘//Let me know if that works….
April 8, 2002 at 3:08 am #4607Michael Cessna
MemberAwesome, I’ll give it a go!
Thanks.
Mike
April 8, 2002 at 3:28 am #4608Michael Cessna
MemberIt worked! Here’s the code, using Delphi:
function GetBeginPeakTime: TTime;
var
vRegistry : TRegistry;
vTimeVal : Integer;
vHour : Word;
vMin : Word;
vSec : Word;
vMSec : Word;
begin
Result := 0;
vRegistry := TRegistry.Create;
try
vRegistry.RootKey := HKEY_LOCAL_MACHINE;
vRegistry.Access := KEY_READ;
if vRegistry.OpenKeyReadOnly(‘SOFTWAREDelrinaWinFax7.0Peak Times’) then
begin
vTimeVal := vRegistry.ReadInteger(‘BeginPeakTime’); { Do not localize. }
if vTimeVal > 0 then
begin
vHour := (vTimeVal and $F800) shr 11;
vMin := (vTimeVal and ทE0) shr 5;
vSec := (vTimeVal and 財F) shl 1;
vMSec := 0;
Result := EncodeTime(vHour, vMin, vSec, vMSec);
end;
end;
finally
vRegistry.Free;
end;
end;function GetEndPeakTime: TTime;
var
vRegistry : TRegistry;
vTimeVal : Integer;
vHour : Word;
vMin : Word;
vSec : Word;
vMSec : Word;
begin
Result := 0;
vRegistry := TRegistry.Create;
try
vRegistry.RootKey := HKEY_LOCAL_MACHINE;
vRegistry.Access := KEY_READ;
if vRegistry.OpenKeyReadOnly(‘SOFTWAREDelrinaWinFax7.0Peak Times’) then
begin
vTimeVal := vRegistry.ReadInteger(‘EndPeakTime’); { Do not localize. }
if vTimeVal > 0 then
begin
vHour := (vTimeVal and $F800) shr 11;
vMin := (vTimeVal and ทE0) shr 5;
vSec := (vTimeVal and 財F) shl 1;
vMSec := 0;
Result := EncodeTime(vHour, vMin, vSec, vMSec);
end;
end;
finally
vRegistry.Free;
end;
end;Thank you!
Mike
April 8, 2002 at 11:36 pm #4609Anonymous
MemberGreat. let us know how your application for WinFax turns out!
-
AuthorPosts
- You must be logged in to reply to this topic.