delphi

首页delphi
06
Oct
0

RzBorder.pas 编译失败Number of elements (125) differs from declaration (224)

下面的变量覆盖一下, 就好了,

原因只是好多乱码地方的}的符号没有 加上就好了

可能编码问题造成的 要不然不会这么多个版本了 还是没有解决

const
DotMasks: TRzLEDCharacters = ( ( { } Col0: $00; Col1: $00; Col2: $00; Col3: $00; Col4: $00 ),

                             ( {!} Col0: $00; Col1: $00; Col2: $FA; Col3: $00; Col4: $00 ),
                             ( {"} Col0: $00; Col1: $C0; Col2: $00; Col3: $C0; Col4: $00 ),
                             ( {#} Col0: $28; Col1: $7C; Col2: $28; Col3: $7C; Col4: $28 ),
                             ( { } Col0: $24; Col1: $54; Col2: $FE; Col3: $54; Col4: $48 ),  // Dollar sign $
                             ( {%} Col0: $64; Col1: $68; Col2: $10; Col3: $2C; Col4: $4C ),
                             ( {&} Col0: $6C; Col1: $92; Col2: $AA; Col3: $44; Col4: $0A ),
                             ( {'} Col0: $00; Col1: $20; Col2: $C0; Col3: $00; Col4: $00 ),
                             ( {(} Col0: $00; Col1: $00; Col2: $7C; Col3: $82; Col4: $00 ),
                             ( {)} Col0: $00; Col1: $82; Col2: $7C; Col3: $00; Col4: $00 ),
                             ( {*} Col0: $54; Col1: $38; Col2: $FE; Col3: $38; Col4: $54 ),
                             ( {+} Col0: $10; Col1: $10; Col2: $7C; Col3: $10; Col4: $10 ),
                             ( {,} Col0: $00; Col1: $02; Col2: $04; Col3: $00; Col4: $00 ),
                             ( {-} Col0: $10; Col1: $10; Col2: $10; Col3: $10; Col4: $10 ),
                             ( {.} Col0: $00; Col1: $00; Col2: $02; Col3: $00; Col4: $00 ),
                             ( {/} Col0: $04; Col1: $08; Col2: $10; Col3: $20; Col4: $40 ),
                             ( {0} Col0: $7C; Col1: $8A; Col2: $92; Col3: $A2; Col4: $7C ),
                             ( {1} Col0: $00; Col1: $42; Col2: $FE; Col3: $02; Col4: $00 ),
                             ( {2} Col0: $46; Col1: $8A; Col2: $92; Col3: $92; Col4: $62 ),
                             ( {3} Col0: $44; Col1: $92; Col2: $92; Col3: $92; Col4: $6C ),
                             ( {4} Col0: $F0; Col1: $10; Col2: $10; Col3: $10; Col4: $FE ),
                             ( {5} Col0: $F4; Col1: $92; Col2: $92; Col3: $92; Col4: $8C ),
                             ( {6} Col0: $7C; Col1: $92; Col2: $92; Col3: $92; Col4: $4C ),
                             ( {7} Col0: $C0; Col1: $80; Col2: $8E; Col3: $90; Col4: $E0 ),
                             ( {8} Col0: $6C; Col1: $92; Col2: $92; Col3: $92; Col4: $6C ),
                             ( {9} Col0: $64; Col1: $92; Col2: $92; Col3: $92; Col4: $7C ),
                             ( {:} Col0: $00; Col1: $00; Col2: $24; Col3: $00; Col4: $00 ),
                             ( {;} Col0: $00; Col1: $02; Col2: $24; Col3: $00; Col4: $00 ),
                             ( {<} Col0: $10; Col1: $28; Col2: $44; Col3: $82; Col4: $00 ),
                             ( {=} Col0: $28; Col1: $28; Col2: $28; Col3: $28; Col4: $28 ),
                             ( {>} Col0: $00; Col1: $82; Col2: $44; Col3: $28; Col4: $10 ),
                             ( {?} Col0: $40; Col1: $80; Col2: $9A; Col3: $90; Col4: $60 ),
                             ( {@} Col0: $7C; Col1: $92; Col2: $AA; Col3: $BA; Col4: $70 ),
                             ( {A} Col0: $7E; Col1: $90; Col2: $90; Col3: $90; Col4: $7E ),
                             ( {B} Col0: $FE; Col1: $92; Col2: $92; Col3: $92; Col4: $6C ),
                             ( {C} Col0: $7C; Col1: $82; Col2: $82; Col3: $82; Col4: $44 ),
                             ( {D} Col0: $FE; Col1: $82; Col2: $82; Col3: $82; Col4: $7C ),
                             ( {E} Col0: $FE; Col1: $92; Col2: $92; Col3: $92; Col4: $82 ),
                             ( {F} Col0: $FE; Col1: $90; Col2: $90; Col3: $90; Col4: $80 ),
                             ( {G} Col0: $7C; Col1: $82; Col2: $92; Col3: $92; Col4: $5C ),
                             ( {H} Col0: $FE; Col1: $10; Col2: $10; Col3: $10; Col4: $FE ),
                             ( {I} Col0: $82; Col1: $82; Col2: $FE; Col3: $82; Col4: $82 ),
                             ( {J} Col0: $04; Col1: $02; Col2: $02; Col3: $02; Col4: $FC ),
                             ( {K} Col0: $FE; Col1: $10; Col2: $28; Col3: $44; Col4: $82 ),
                             ( {L} Col0: $FE; Col1: $02; Col2: $02; Col3: $02; Col4: $02 ),
                             ( {M} Col0: $FE; Col1: $40; Col2: $20; Col3: $40; Col4: $FE ),
                             ( {N} Col0: $FE; Col1: $20; Col2: $10; Col3: $08; Col4: $FE ),
                             ( {O} Col0: $7C; Col1: $82; Col2: $82; Col3: $82; Col4: $7C ),
                             ( {P} Col0: $FE; Col1: $90; Col2: $90; Col3: $90; Col4: $60 ),
                             ( {Q} Col0: $7C; Col1: $82; Col2: $82; Col3: $86; Col4: $7E ),
                             ( {R} Col0: $FE; Col1: $90; Col2: $90; Col3: $90; Col4: $6E ),
                             ( {S} Col0: $64; Col1: $92; Col2: $92; Col3: $92; Col4: $4C ),
                             ( {T} Col0: $80; Col1: $80; Col2: $FE; Col3: $80; Col4: $80 ),
                             ( {U} Col0: $FC; Col1: $02; Col2: $02; Col3: $02; Col4: $FC ),
                             ( {V} Col0: $E0; Col1: $18; Col2: $06; Col3: $18; Col4: $E0 ),
                             ( {W} Col0: $FC; Col1: $02; Col2: $0C; Col3: $02; Col4: $FC ),
                             ( {X} Col0: $C6; Col1: $28; Col2: $10; Col3: $28; Col4: $C6 ),
                             ( {Y} Col0: $C0; Col1: $20; Col2: $1E; Col3: $20; Col4: $C0 ),
                             ( {Z} Col0: $86; Col1: $8A; Col2: $92; Col3: $A2; Col4: $C2 ),
                             ( {[} Col0: $00; Col1: $FE; Col2: $82; Col3: $82; Col4: $00 ),
                             ( {\} Col0: $40; Col1: $20; Col2: $10; Col3: $08; Col4: $04 ),
                             ( {]} Col0: $00; Col1: $82; Col2: $82; Col3: $FE; Col4: $00 ),
                             ( {^} Col0: $20; Col1: $40; Col2: $80; Col3: $40; Col4: $20 ),
                             ( {_} Col0: $02; Col1: $02; Col2: $02; Col3: $02; Col4: $02 ),
                             ( {`} Col0: $00; Col1: $00; Col2: $C0; Col3: $20; Col4: $00 ),
                             ( {a} Col0: $04; Col1: $2A; Col2: $2A; Col3: $2A; Col4: $1E ),
                             ( {b} Col0: $FE; Col1: $22; Col2: $22; Col3: $22; Col4: $1C ),
                             ( {c} Col0: $1C; Col1: $22; Col2: $22; Col3: $22; Col4: $14 ),
                             ( {d} Col0: $1C; Col1: $22; Col2: $22; Col3: $22; Col4: $FE ),
                             ( {e} Col0: $1C; Col1: $2A; Col2: $2A; Col3: $2A; Col4: $18 ),
                             ( {f} Col0: $10; Col1: $7E; Col2: $90; Col3: $90; Col4: $40 ),
                             ( {g} Col0: $10; Col1: $2A; Col2: $2A; Col3: $2A; Col4: $1C ),
                             ( {h} Col0: $FE; Col1: $20; Col2: $20; Col3: $20; Col4: $1E ),
                             ( {i} Col0: $00; Col1: $22; Col2: $BE; Col3: $02; Col4: $00 ),
                             ( {j} Col0: $00; Col1: $02; Col2: $BC; Col3: $00; Col4: $00 ),
                             ( {k} Col0: $FE; Col1: $08; Col2: $08; Col3: $14; Col4: $22 ),
                             ( {l} Col0: $00; Col1: $82; Col2: $FE; Col3: $02; Col4: $00 ),
                             ( {m} Col0: $3E; Col1: $20; Col2: $3E; Col3: $20; Col4: $1E ),
                             ( {n} Col0: $3E; Col1: $20; Col2: $20; Col3: $20; Col4: $1E ),
                             ( {o} Col0: $1C; Col1: $22; Col2: $22; Col3: $22; Col4: $1C ),
                             ( {p} Col0: $3E; Col1: $28; Col2: $28; Col3: $28; Col4: $10 ),
                             ( {q} Col0: $10; Col1: $28; Col2: $28; Col3: $28; Col4: $3E ),
                             ( {r} Col0: $3E; Col1: $20; Col2: $20; Col3: $20; Col4: $10 ),
                             ( {s} Col0: $12; Col1: $2A; Col2: $2A; Col3: $2A; Col4: $24 ),
                             ( {t} Col0: $20; Col1: $FC; Col2: $22; Col3: $22; Col4: $00 ),
                             ( {u} Col0: $3C; Col1: $02; Col2: $02; Col3: $02; Col4: $3E ),
                             ( {v} Col0: $38; Col1: $04; Col2: $02; Col3: $04; Col4: $38 ),
                             ( {w} Col0: $3C; Col1: $02; Col2: $0C; Col3: $02; Col4: $3C ),
                             ( {x} Col0: $22; Col1: $14; Col2: $08; Col3: $14; Col4: $22 ),
                             ( {y} Col0: $22; Col1: $14; Col2: $08; Col3: $10; Col4: $20 ),
                             ( {z} Col0: $22; Col1: $26; Col2: $2A; Col3: $32; Col4: $22 ),
                             ( { } Col0: $00; Col1: $10; Col2: $6C; Col3: $82; Col4: $00 ),  // {
                             ( {|} Col0: $00; Col1: $00; Col2: $FE; Col3: $00; Col4: $00 ),
                             ( { } Col0: $00; Col1: $82; Col2: $6C; Col3: $10; Col4: $00 ),  // }
                             ( {~} Col0: $40; Col1: $80; Col2: $40; Col3: $20; Col4: $40 ),

                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( {€} Col0: $00; Col1: $00; Col2: $00; Col3: $00; Col4: $00 ),

                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character

                             ( {厎 }Col0: $00; Col1: $00; Col2: $00; Col3: $00; Col4: $00 ),
                             ( {唥 }Col0: $00; Col1: $00; Col2: $00; Col3: $00; Col4: $00 ),

                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character

                             ( {憓 }Col0: $00; Col1: $00; Col2: $00; Col3: $00; Col4: $00 ),
                             ( {憓 }Col0: $00; Col1: $00; Col2: $00; Col3: $00; Col4: $00 ),

                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character

                             ( {檥 }Col0: $00; Col1: $00; Col2: $00; Col3: $00; Col4: $00 ),

                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character
                             ( { } Col0: $00; Col1: $7C; Col2: $7C; Col3: $7C; Col4: $00 ), // Unsupported Character

                             ( {} Col0: $00; Col1: $00; Col2: $BE; Col3: $00; Col4: $00 ),
                             ( {}Col0: $38; Col1: $44; Col2: $FE; Col3: $44; Col4: $28 ),
                             ( {}Col0: $06; Col1: $7A; Col2: $92; Col3: $92; Col4: $42 ),
                             ( {}Col0: $44; Col1: $38; Col2: $28; Col3: $38; Col4: $44 ),
                             ( {}Col0: $D0; Col1: $30; Col2: $1E; Col3: $30; Col4: $D0 ),
                             ( {}Col0: $00; Col1: $00; Col2: $EE; Col3: $00; Col4: $00 ),
                             ( {}Col0: $52; Col1: $AA; Col2: $AA; Col3: $AA; Col4: $94 ),
                             ( {▆ }Col0: $00; Col1: $80; Col2: $00; Col3: $80; Col4: $00 ),
                             ( {﹠ }Col0: $7C; Col1: $92; Col2: $AA; Col3: $AA; Col4: $7C ),
                             ( {獇 }Col0: $00; Col1: $B4; Col2: $B4; Col3: $74; Col4: $00 ),
                             ( {珆 }Col0: $08; Col1: $14; Col2: $2A; Col3: $14; Col4: $22 ),
                             ( {瑌 }Col0: $10; Col1: $10; Col2: $10; Col3: $10; Col4: $18 ),
                             ( {瓆 }Col0: $00; Col1: $10; Col2: $10; Col3: $10; Col4: $00 ),
                             ( {畗 }Col0: $7C; Col1: $82; Col2: $BA; Col3: $A2; Col4: $7C ),
                             ( {瘆 }Col0: $80; Col1: $80; Col2: $80; Col3: $80; Col4: $80 ),
                             ( {皚 }Col0: $00; Col1: $40; Col2: $A0; Col3: $40; Col4: $00 ),
                             ( {眪 }Col0: $00; Col1: $24; Col2: $74; Col3: $24; Col4: $00 ),
                             ( {瞹 }Col0: $00; Col1: $90; Col2: $B0; Col3: $50; Col4: $00 ),
                             ( {硙 }Col0: $00; Col1: $88; Col2: $A8; Col3: $70; Col4: $00 ),
                             ( {磢 }Col0: $00; Col1: $00; Col2: $40; Col3: $80; Col4: $00 ),
                             ( {祡 }Col0: $3E; Col1: $04; Col2: $04; Col3: $38; Col4: $04 ),
                             ( {秨 }Col0: $60; Col1: $F0; Col2: $FE; Col3: $80; Col4: $FE ),
                             ( {穧 }Col0: $00; Col1: $00; Col2: $10; Col3: $00; Col4: $00 ),
                             ( {竲 }Col0: $00; Col1: $02; Col2: $0A; Col3: $04; Col4: $00 ),
                             ( {箎 }Col0: $00; Col1: $50; Col2: $F0; Col3: $10; Col4: $00 ),
                             ( {簘 }Col0: $00; Col1: $50; Col2: $B0; Col3: $50; Col4: $00 ),
                             ( {粆 }Col0: $22; Col1: $14; Col2: $2A; Col3: $14; Col4: $08 ),
                             ( {紏 }Col0: $E8; Col1: $10; Col2: $2C; Col3: $44; Col4: $9E ),
                             ( {絵 }Col0: $E8; Col1: $10; Col2: $20; Col3: $56; Col4: $8A ),
                             ( {緘 }Col0: $E8; Col1: $F0; Col2: $2C; Col3: $44; Col4: $9E ),
                             ( {縸 }Col0: $04; Col1: $02; Col2: $B2; Col3: $0A; Col4: $04 ),
                             ( {纝 }Col0: $1E; Col1: $A8; Col2: $68; Col3: $28; Col4: $1E ),
                             ( {羮 }Col0: $1E; Col1: $28; Col2: $68; Col3: $A8; Col4: $1E ),
                             ( {聖 }Col0: $1E; Col1: $68; Col2: $A8; Col3: $68; Col4: $1E ),
                             ( {脈 }Col0: $5E; Col1: $A8; Col2: $A8; Col3: $68; Col4: $9E ),
                             ( {膤 }Col0: $1E; Col1: $A8; Col2: $28; Col3: $A8; Col4: $1E ),
                             ( {舽 }Col0: $1E; Col1: $28; Col2: $A8; Col3: $28; Col4: $1E ),
                             ( {苶 }Col0: $7E; Col1: $90; Col2: $FE; Col3: $92; Col4: $92 ),
                             ( {莭 }Col0: $78; Col1: $84; Col2: $86; Col3: $84; Col4: $48 ),
                             ( {葈 }Col0: $78; Col1: $84; Col2: $86; Col3: $84; Col4: $48 ),
                             ( {蓕 }Col0: $3E; Col1: $2A; Col2: $6A; Col3: $AA; Col4: $22 ),
                             ( {蕔 }Col0: $3E; Col1: $6A; Col2: $AA; Col3: $6A; Col4: $22 ),
                             ( {藑 }Col0: $3E; Col1: $AA; Col2: $2A; Col3: $AA; Col4: $22 ),
                             ( {蘿 }Col0: $22; Col1: $A2; Col2: $7E; Col3: $22; Col4: $22 ),
                             ( {蛚 }Col0: $22; Col1: $22; Col2: $7E; Col3: $A2; Col4: $22 ),
                             ( {蝳 }Col0: $22; Col1: $62; Col2: $BE; Col3: $62; Col4: $22 ),
                             ( {蟷 }Col0: $22; Col1: $A2; Col2: $3E; Col3: $A2; Col4: $22 ),
                             ( {衹 }Col0: $10; Col1: $FE; Col2: $92; Col3: $44; Col4: $38 ),
                             ( {複 }Col0: $7E; Col1: $90; Col2: $88; Col3: $44; Col4: $BE ),
                             ( {襺 }Col0: $1C; Col1: $A2; Col2: $62; Col3: $22; Col4: $14 ),
                             ( {觹 }Col0: $1C; Col1: $22; Col2: $62; Col3: $A2; Col4: $14 ),
                             ( {詝 }Col0: $1C; Col1: $62; Col2: $A2; Col3: $62; Col4: $14 ),
                             ( {諁 }Col0: $5C; Col1: $A2; Col2: $A2; Col3: $62; Col4: $94 ),
                             ( {謢 }Col0: $1C; Col1: $A2; Col2: $22; Col3: $A2; Col4: $14 ),
                             ( {讅 }Col0: $00; Col1: $14; Col2: $08; Col3: $14; Col4: $00 ),
                             ( {貆 }Col0: $7C; Col1: $8A; Col2: $92; Col3: $A2; Col4: $7C ),
                             ( {賫 }Col0: $7C; Col1: $82; Col2: $42; Col3: $02; Col4: $7C ),
                             ( {趠 }Col0: $7C; Col1: $02; Col2: $42; Col3: $82; Col4: $7C ),
                             ( {踼 }Col0: $7C; Col1: $42; Col2: $82; Col3: $42; Col4: $7C ),
                             ( {軁 }Col0: $7C; Col1: $82; Col2: $02; Col3: $82; Col4: $7C ),
                             ( {輢 }Col0: $60; Col1: $10; Col2: $4E; Col3: $90; Col4: $60 ),
                             ( {迃 }Col0: $00; Col1: $FE; Col2: $28; Col3: $28; Col4: $10 ),
                             ( {遾 }Col0: $7E; Col1: $90; Col2: $92; Col3: $72; Col4: $0C ),
                             ( {鄛 }Col0: $04; Col1: $AA; Col2: $6A; Col3: $2A; Col4: $1E ),
                             ( {醹 }Col0: $04; Col1: $2A; Col2: $6A; Col3: $AA; Col4: $1E ),
                             ( {鈣 }Col0: $04; Col1: $6A; Col2: $AA; Col3: $6A; Col4: $1E ),
                             ( {銄 }Col0: $44; Col1: $AA; Col2: $AA; Col3: $6A; Col4: $9E ),
                             ( {鋧 }Col0: $04; Col1: $AA; Col2: $2A; Col3: $AA; Col4: $1E ),
                             ( {鍈 }Col0: $04; Col1: $2A; Col2: $AA; Col3: $2A; Col4: $1E ),
                             ( {鎪 }Col0: $04; Col1: $2A; Col2: $3E; Col3: $2A; Col4: $1A ),
                             ( {鐌 }Col0: $18; Col1: $24; Col2: $26; Col3: $24; Col4: $00 ),
                             ( {鑮 }Col0: $1C; Col1: $AA; Col2: $6A; Col3: $2A; Col4: $18 ),
                             ( {閩 }Col0: $1C; Col1: $2A; Col2: $6A; Col3: $AA; Col4: $18 ),
                             ( {陖 }Col0: $1C; Col1: $6A; Col2: $AA; Col3: $6A; Col4: $18 ),
                             ( {雧 }Col0: $1C; Col1: $AA; Col2: $2A; Col3: $AA; Col4: $18 ),
                             ( {靰 }Col0: $00; Col1: $A2; Col2: $7E; Col3: $02; Col4: $00 ),
                             ( {韢 }Col0: $00; Col1: $22; Col2: $7E; Col3: $82; Col4: $00 ),
                             ( {題 }Col0: $00; Col1: $62; Col2: $BE; Col3: $42; Col4: $00 ),
                             ( {飣 }Col0: $00; Col1: $A2; Col2: $3E; Col3: $82; Col4: $00 ),
                             ( {饈 }Col0: $0C; Col1: $B2; Col2: $52; Col3: $B2; Col4: $1C ),
                             ( {駗 }Col0: $7E; Col1: $A0; Col2: $A0; Col3: $60; Col4: $9E ),
                             ( {騷 }Col0: $1C; Col1: $A2; Col2: $62; Col3: $22; Col4: $1C ),
                             ( {髛 }Col0: $1C; Col1: $22; Col2: $62; Col3: $A2; Col4: $1C ),
                             ( {魙 }Col0: $1C; Col1: $62; Col2: $A2; Col3: $62; Col4: $1C ),
                             ( {鮹 }Col0: $5C; Col1: $A2; Col2: $A2; Col3: $62; Col4: $9C ),
                             ( {鰙 }Col0: $1C; Col1: $A2; Col2: $22; Col3: $A2; Col4: $1C ),
                             ( {鱹 }Col0: $10; Col1: $10; Col2: $54; Col3: $10; Col4: $10 ),
                             ( {鴠 }Col0: $3A; Col1: $4C; Col2: $54; Col3: $64; Col4: $B8 ),
                             ( {鶀 }Col0: $3C; Col1: $82; Col2: $42; Col3: $02; Col4: $3E ),
                             ( {鷠 }Col0: $3C; Col1: $02; Col2: $42; Col3: $82; Col4: $3E ),
                             ( {鹽 }Col0: $3C; Col1: $42; Col2: $82; Col3: $42; Col4: $3E ),
                             ( {鼄 }Col0: $3C; Col1: $82; Col2: $02; Col3: $82; Col4: $3E ),
                             ( {齷 }Col0: $22; Col1: $14; Col2: $48; Col3: $90; Col4: $20 ),
                             ( { }Col0: $00; Col1: $7E; Col2: $14; Col3: $08; Col4: $00 ),
                             ( {} Col0: $22; Col1: $94; Col2: $08; Col3: $90; Col4: $20 )
                            );

{===========================}
{== TRzLEDDisplay Methods ==}
{===========================}

26
Sep
0

判断当前网卡是物理网卡(有线网卡,无线网卡)还是虚拟网卡

MAC地址作为硬件唯一标识,在很多时候会被使用,如在软件授权方面,很多软件在产生机器码时会采用CPUID或MAC地址,或使用MAC地址来做一对一绑定。

相信很多人会碰到以下问题:

1)获取的是VMWare的网卡MAC地址

2)获取的是VPN的网卡MAC地址

VMWare或VPN软件的安装卸载都会导致获取的MAC地址变化,所以我们需要正确获取当前物理网卡的MAC地址。

下面是根据网卡实例ID判断是否为物理网卡的Delphi代码(RAD Studio 10.1版本的):

复制代码
const
NCF_VIRTUAL =$01; // 说明组件是个虚拟适配器
NCF_SOFTWARE_ENUMERATED = $02;// 说明组件是一个软件模拟的适配器
NCF_PHYSICAL = $04; // 说明组件是一个物理适配器
NCF_HIDDEN = $08; //说明组件不显示用户接口
NCF_NO_SERVICE = $10; // 说明组件没有相关的服务(设备驱动程序)
NCF_NOT_USER_REMOVABLE = $20; // 说明不能被用户删除(例如,通过控制面板或设备管理器)
NCF_MULTIPORT_INSTANCED_ADAPTER = $40; // 说明组件有多个端口,每个端 口作为单独的设备安装。

                                      //  每个 端口有自己的hw_id(组件ID) 并可被单独安装,
                                      //  这只适合于 EISA适配器

NCF_HAS_UI = $80; // 说明组件支持用户接口(例如,Advanced Page或Customer Properties Sheet)
NCF_FILTER = $400; // 说明组件是一个过滤器

function IsPhysicalAdapter(sAdapterGUID: string; bOnlyPCI: Boolean=False):Boolean;
const

NET_CARD_KEY_PATH =
'SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}';

var

Reg: TRegistry;
sList: TStrings;
vCharacteristics: DWORD;
I: Integer;

begin

Result := False;
sList:=TStringList.Create;
Reg:=TRegistry.Create;
try
  Reg.RootKey := HKEY_LOCAL_MACHINE;
  if not Reg.OpenKey(NET_CARD_KEY_PATH, False) then
    Exit;
  Reg.GetKeyNames(sList);
  Reg.CloseKey;
  if sList.Count>0 then
  for I := 0 to Pred(sList.Count) do
  if Reg.OpenKey(NET_CARD_KEY_PATH+'\'+sList.Strings[I], False) then
  begin
    try
      if sAdapterGUID.ToUpper.Trim.Equals(Reg.ReadString('NetCfgInstanceId').ToUpper.Trim) then
      begin
        vCharacteristics := DWORD(Reg.ReadInteger('Characteristics'));
        Result := (NCF_PHYSICAL and vCharacteristics) = NCF_PHYSICAL;
        Break;
      end;
    finally
      Reg.CloseKey;
    end;
  end;
finally
  Reg.Free;
  sList.Free;
end;

end;
复制代码

上面IsPhysicalAdapter的参数网卡实例ID通过GetAdaptersInfo即可得到,综合起来的具体代码如下:

注意:

调用 GetAdaptersInfo 可以直接引用下面2个单元

Winapi.IpTypes,
Winapi.IpHlpApi

复制代码
function GetMacAddress(): string;
var
dwRet: DWORD;
AI,Work : PIpAdapterInfo;
sGUID, sTmp, sLastMAC, sFirstMAC: string;
I: Integer;
uSize: ULONG;
begin
Result := '';
sLastMAC := '';
sFirstMAC := '';
uSize := SizeOf(TIpAdapterInfo);
GetMem(AI,uSize);
dwRet := GetAdaptersInfo(AI,uSize);
if (dwRet = ERROR_BUFFER_OVERFLOW)then
begin

FreeMem(AI);
GetMem(AI,uSize);
dwRet := GetAdaptersInfo(AI,uSize);

end;
try

if (dwRet <> ERROR_SUCCESS)then
  Exit;
Work := AI;
while Work<>nil do
begin
  try
    sGUID := string(AnsiString(Work.AdapterName));
    sTmp := string(AnsiString(Work.Description));
    // 名称描述出现VMWare,直接忽略
    if Pos('VMWare', sTmp)>0 then
      Continue;
    // 配置的ID地址不正常,忽略
    if Work.AddressLength=0 then
      Continue;

    // 将网卡MAC地址转成字符串
    sLastMAC := '';
    for I:=0 to Work.AddressLength-1 do
    begin
      sLastMAC := sLastMAC + Format('%.2x', [Work.Address[I]]);
    end;

    if sFirstMAC='' then
      sFirstMAC := sLastMAC;

    // 不是物理网卡,忽略
    if not IsPhysicalAdapter(sGUID) then
      Continue;

    Result := sLastMAC;

    //找到第一个物理网卡后退出
    Break;
  finally
    Work := Work.Next;
  end;
end;
// 找不到物理网卡MAC,返回第一个即可
if Result='' then
  Result := sFirstMAC;

finally

FreeMem(AI);

end;
end;
复制代码

理论上从软件层面是无法直接判断一个网络适配器硬件到底是有线还是无线的,因为不管是miniPCIE还是普通PCI接口的网卡,都可以是有线也可以是无线,

但是也有以下的方法判断:

1)网卡可以通过名称描述上判断:一般有线网卡名称上带PCI,无线带WLAN 或Wireless,此方法不依赖于网络是否连接,但对那些自定义驱动名称的高人当然无效

2)获取网络配置信息,也就是获取网络连接里的整个列表,包含物理网卡和宽带连接,VPN等各种连接设备信息,再查看连接类型,根据MSDN的说明,类型包含ETHERNET/PPP/IEEE80211等等,甚至包含移动手机卡的类型。
3)获取网络速率,和2)一样也是获取网络连接的配置信息,100/10Mbps一般是有线,54Mbps或其他一般为WLAN连接,虽说WLAN并不包含一个最高的速度标准,但是普通2.4G或5G的WIFI速度也快不到哪去。

注:

方法 2)和3)中的网络类型和网络速率均是通过 API GetIfEntry配合GetAdaptersInfo 获取(或直接通过 GetIfTable获取)网络配置信息得到的,代码MSDN也有

具体查看MSDN中对此函数返回的结构体MIB_IFROW字段dwType和dwSpeed的说明,除了类型速率,也包含其他非常多的信息。

26
Sep
0

Delphi常用类型及定义单元

Type Unit
Date SysUtils
DeleteFile SysUtils or Windows (different versions)
DispatchInvokeError ComObj
DWORD Windows
EDatabaseError DB
EncodeDateTime DateUtils
_Stream ADODB_TLB
akTop, akLeft, akRight, akBottom Controls
Application (the variable not a type) Forms
Beep SysUtils or Windows (different functions)
CGID_EXPLORER ShlObj
CN_BASE Controls
CoInitialize ActiveX
CopyFile Windows
CoUnInitialize ActiveX
CreateComObject ComObj
CreateOleObject ComObj
EnumWindows Windows
EOleError ComObj
EOleException ComObj
EOleSysError ComObj
Exception SysUtils
ExtractFileName SysUtils
FileExists SysUtils
FileOpen SysUtils
FILETIME Windows
FindFirst SysUtils
FindFirstFile Windows
FindWindow Windows
FlushFileBuffers Windows
fmOpenRead SysUtils
fmShareDenyWrite SysUtils
Format SysUtils
FormatDateTime SysUtils
FreeAndNil SysUtils
fsBold Graphics
ftWideString DB
ftString DB
GetCurrentProcessId Windows
GetEnvironmentVariable SysUtils or Windows (different versions)
GetFileAttributes Windows
GetFileVersionInfoSize Windows
GetWindowLong Windows
GetStdHandle Windows
HDC Windows
HFont Windows
HINTERNET WinInet
HKEY_CURRENT_USER Windows
IHTMLDocument2 MSHTML or MSHTML_TLB
IHTMLElement MSHTML or MSHTML_TLB
IHTMLEventObj MSHTML or MSHTML_TLB
IID_IWebBrowser2 SHDocVw or SHDocVw_TLB
IMessage CDO_TLB
InternetClosehandle WinInet
InternetOpenUrl WinInet
InternetReadFile WinInet
IntToHex SysUtils
IntToStr SysUtils
IOleCommandTarget ActiveX
IOleContainer ActiveX
IPersistStreamInit ActiveX
IsSameDay DateUtils
IStream ActiveX
IWebBrowser2 SHDocVw or SHDocVw_TLB
LockWindowUpdate Windows
Log10 Math
LowerCase SysUtils
LPSTR Windows
MAX_PATH Windows
MessageBox Windows
MessageDlg Dialogs
MB_YESNO, MB_OK etc Windows
MinutesBetween DateUtils
Now SysUtils
OleInitialize ActiveX
OleUninitialize ActiveX
PItemIDList ShlObj
POleCmd ActiveX
POleCmdText ActiveX
PostMessage Windows
PosX StrUtils
QueryHighPerformanceCounter Windows
QueryPerformanceCounter Windows
ReverseString StrUtils
RoundTo Math
SendMessage Windows
SetForegroundWindow Windows
ShellExecute ShellAPI
ShellExecuteEx ShellAPI
SHGetFileInfo ShellAPI
SHFILEINFO ShellAPI
ShowMessage Dialogs
Sleep SysUtils
StrAlloc SysUtils
StrPas SysUtils
StrToDate SysUtils
StrToInt SysUtils
StrToIntDef SysUtils
TAdoConnection ADODB
TAdoQuery ADODB
TAlign Controls
TAlignment Classes
TAnchors Controls
TBitmap Graphics
TBlobStream DBTables
TCanvas Graphics
TClientSocket ScktComp
TComboBox StdCtrls
TComponent Classes
TControl Controls or QControls
TCriticalSection SyncObjs
TField DB
TFieldType DB
TFileName SysUtils
TFileStream Classes
TForm Forms
TFrame Forms
TGroupBox StdCtrls
TIID ActiveX
TIniFile IniFiles
TJPEGImage Jpeg
TLabel StdCtrls
TList Classes
TMemo StdCtrls
TMemoryStream Classes
TMouseButton Controls
TNofityEvent Classes
TObjectList Contnrs
TOSVersionInfo Windows
TPanel ExtCtrls
TPoint Types
TProcessEntry32 TlHelp32
TProgressBar ComCtrls or QComCtrls
TRadioButton StdCtrls
TRadioGroup ExtCtrls
TRect Types
TRegistry Registry
Trim SysUtils
TRoundToRange Math
TSearchRec SysUtils
TSize Windows
TSocketAddrIn Winsock
TStaticText StdCtrls
TStream Classes
TStringList Classes
TStrings Classes
TStringStream Classes
TSystemTime Windows
TTable DBTables
TTabSheet ComCtrls
TThread Classes
TTreeNode ComCtrls
TWebBrowser SHDocVw or SHDocVw_TLB
TWinSocketStream ScktComp
TWMCommand Messages
Unassigned Variants
VarArrayCreate Variants
VarArrayOf Variants
VirtualProtect Windows
WM_USER Messages
YearOf DateUtils
DaysInAMonth DateUtils

18
Oct
0

简单的调试以及异常触发显示行号记录行号的类

实际上是HOOK了system的Assert,在 ZytDebug.pas里,通过命令行输入 debug 还是 log。

/Debug 在错误处调用 Assert 可以显示行号??

ZytDebug.pas 有三个函数

procedure Debug(const S: string);

procedure DebugEnter(const S: string);

procedure DebugLeave(const S: string);

可以在 IDE debug窗口中中形成类似的缩进的效果。

有两个单元 ZytDebug.pas和Zytlogger.pas。

Zytlogger.pas 仅对 PFeng 的日之类进行了接口封装,自创建自销毁。仅两个函数:

1: function ZytLog:IZytLogger; overload;

2: function ZytLog(LogDir: AnsiString;LogShower:TComponent=nil):IZytLogger;overload;

直接调用即可。第二个可以指定日志显示容器载体。

希望对初学者有帮助。

支持delphibbs 重开。

附件为简单测试。

TestAssert.zip

28
Sep
0

遍历文件夹及子目录

简单遍历一个文件夹内容

function GetDirectorys(dir: string): TStringList;
var
  SearchRec: TSearchRec;
  i:integer;
  sl:TStringList;
begin
  sl := TStringList.Create;
  if not DirectoryExists(dir) then
    Exit(sl);
  i := FindFirst(dir + '*.*', faDirectory, SearchRec);
  while i = 0 do
  begin
    if (SearchRec.Name<>'.') and (SearchRec.Name<>'..') and (SearchRec.Attr = faDirectory) then
      sl.Add(SearchRec.Name);
    i := FindNext(SearchRec)
  end;
  FindClose(SearchRec);
  Result := sl;
end;

递归

function MakeFileList(Path,FileExt:string):TStringList ;
var
sch:TSearchrec;
begin
Result:=TStringlist.Create;
if rightStr(trim(Path), 1) <> '\' then
    Path := trim(Path) + '\'
else
    Path := trim(Path);
if not DirectoryExists(Path) then
begin
    Result.Clear;
    exit;
end;
if FindFirst(Path + '*', faAnyfile, sch) = 0 then
begin
    repeat
       Application.ProcessMessages;
       if ((sch.Name = '.') or (sch.Name = '..')) then Continue;
       if DirectoryExists(Path+sch.Name) then   // 这个地方加上一个判断,可以区别子文件夹河当前文件夹的操作
       begin
         Result.AddStrings(MakeFileList(Path+sch.Name,FileExt));
       end
       else
       begin
         if (UpperCase(extractfileext(Path+sch.Name)) = UpperCase(FileExt)) or (FileExt='.*') then
         Result.Add(Path+sch.Name);
       end;
    until FindNext(sch) <> 0;
    SysUtils.FindClose(sch);
end;
end;

加入递归 所有子目录遍历

procedure EnumFileInQueue(path: PChar; fileExt: string; fileList: TStringList);  
var 
   searchRec: TSearchRec;  
   found: Integer;  
   tmpStr: string;  
   curDir: string;  
   dirs: TQueue;  
   pszDir: PChar;  
begin 
   dirs := TQueue.Create; //创建目录队列  
   dirs.Push(path); //将起始搜索路径入队  
   pszDir := dirs.Pop;  
   curDir := StrPas(pszDir); //出队  
   {开始遍历,直至队列为空(即没有目录需要遍历)} 
   while (True) do 
   begin 
      //加上搜索后缀,得到类似'c:\*.*' 、'c:\windows\*.*'的搜索路径  
      tmpStr := curDir + '\*.*';  
      //在当前目录查找第一个文件、子目录  
      found := FindFirst(tmpStr, faAnyFile, searchRec);  
      while found = 0 do //找到了一个文件或目录后  
      begin 
          //如果找到的是个目录  
         if (searchRec.Attr and faDirectory) <> 0 then 
         begin 
          {在搜索非根目录(C:\、D:\)下的子目录时会出现'.','..'的"虚拟目录" 
          大概是表示上层目录和下层目录吧。。。要过滤掉才可以} 
            if (searchRec.Name <> '.') and (searchRec.Name <> '..') then 
            begin 
               {由于查找到的子目录只有个目录名,所以要添上上层目录的路径 
                searchRec.Name = 'Windows'; 
                tmpStr:='c:\Windows'; 
                加个断点就一清二楚了 
               } 
               tmpStr := curDir + '\' + searchRec.Name;  
               {将搜索到的目录入队。让它先晾着。 
                因为TQueue里面的数据只能是指针,所以要把string转换为PChar 
                同时使用StrNew函数重新申请一个空间存入数据,否则会使已经进 
                入队列的指针指向不存在或不正确的数据(tmpStr是局部变量)。} 
               dirs.Push(StrNew(PChar(tmpStr)));  
            end;  
         end 
         else //如果找到的是个文件  
         begin 
             {Result记录着搜索到的文件数。可是我是用CreateThread创建线程 
              来调用函数的,不知道怎么得到这个返回值。。。我不想用全局变量} 
            //把找到的文件加到Memo控件  
            if fileExt = '.*' then 
               fileList.Add(curDir + '\' + searchRec.Name)  
            else 
            begin 
               if SameText(RightStr(curDir + '\' + searchRec.Name, Length(fileExt)), fileExt) then 
                  fileList.Add(curDir + '\' + searchRec.Name);  
            end;  
         end;  
          //查找下一个文件或目录  
         found := FindNext(searchRec);  
      end;  
      {当前目录找到后,如果队列中没有数据,则表示全部找到了; 
        否则就是还有子目录未查找,取一个出来继续查找。} 
      if dirs.Count > 0 then 
      begin 
         pszDir := dirs.Pop;  
         curDir := StrPas(pszDir);  
         StrDispose(pszDir);  
      end 
      else 
         break;  
   end;  
   //释放资源  
   dirs.Free;  
   FindClose(searchRec);  
end;