Fax Software

Community Forums

This topic contains 4 replies, has 0 voices, and was last updated by  Anonymous 16 years, 8 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2706

    Does 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

    #4606

    Anonymous
    Member

    I’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….

    #4607

    Awesome, I’ll give it a go!

    Thanks.

    Mike

    #4608

    It 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 &#36F800) shr 11;
    vMin := (vTimeVal and &#3607E0) shr 5;
    vSec := (vTimeVal and &#36001F) 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 &#36F800) shr 11;
    vMin := (vTimeVal and &#3607E0) shr 5;
    vSec := (vTimeVal and &#36001F) shl 1;
    vMSec := 0;
    Result := EncodeTime(vHour, vMin, vSec, vMSec);
    end;
    end;
    finally
    vRegistry.Free;
    end;
    end;

    Thank you!

    Mike

    #4609

    Anonymous
    Member

    Great. let us know how your application for WinFax turns out!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.