uses dvcrt, winprocs, wintypes;
var m: TEventMsg;
    arq: file of TEventMsg;
    s: string;
    cod: longint;

    function hexa (v: longint): string;
    var h1, h2, h3, h4: char;
    const tabhexa: array [0..15] of char = (
        '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f');
    begin
        h1 := tabhexa [(v shr 12) and $f];
        h2 := tabhexa [(v shr 8) and $f];
        h3 := tabhexa [(v shr 4) and $f];
        h4 := tabhexa [v and $f];
        hexa := h1+h2+h3+h4;
    end;


begin
    assign (arq, 'hookit.mac');
    reset (arq);
    while not eof (arq) do
        begin
            read (arq, m);
            cod := m.message;

            s := '';
            if      cod = $0100 then s := 'wm_KeyDown'
            else if cod = $0101 then s := 'wm_KeyUp'
            else if cod = $0102 then s := 'wm_Char'
            else if cod = $0103 then s := 'wm_DeadChar'
            else if cod = $0104 then s := 'wm_SysKeyDown'
            else if cod = $0105 then s := 'wm_SysKeyUp'
            else if cod = $0106 then s := 'wm_SysChar'
            else if cod = $0107 then s := 'wm_SysDeadChar'
            else if cod = $0108 then s := 'wm_KeyLast'
            ;

            with m do
                writeln (hexa(message), ' (', s, ') ',
                         hexa(paraml), ' ',  hexa(paramh), ' ', hexa(time));
            readln;
        end;
    close (arq);
end.

