Blog信息 |
blog名称:注册会计师(注会)练习软件 日志总数:398 评论数量:116 留言数量:27 访问次数:3267721 建立时间:2005年6月6日 |

| |
[delpih编程]delphi写的一个读写xml格式配置文件的帮助类 【转贴】 软件技术
吕向阳 发表于 2009/4/20 21:26:14 |
delphi写的一个读写xml格式配置文件的帮助类
unit uSystemParams;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, MSXML2_TLB, uUtility;
type
TSystemParams = class
private
FXmlDocument: IXMLDOMDocument;
FXmlFileName : String;
protected
public
constructor Create(const xmlfilename : String); overload;virtual;
constructor Create; overload;virtual;
destructor Destroy; override;
procedure loadFromFile(const xmlfilename : String); virtual;
procedure saveToFile; overload;virtual;
procedure saveToFile(const xmlFileName : String); overload;virtual;
function getXmlDocument: IXMLDOMDocument; virtual;
function getElementText(const nodePath: string; const defaultValue : String = ''): string; virtual;
procedure setElementText(const nodepath, value: |
|
[delpih编程]公司用字符串加密解密函数(delphi版)【转贴】 软件技术
吕向阳 发表于 2009/4/18 17:41:10 |
公司用字符串加密函数(delphi版)(2006-07-07 14:29:59)
{字符串加密解密 2005.04.12 Wahnch Yeh} unit uEncrypt; interface uses sysutils; const Encrypt_Const = $3412; function Encrypt(const S: String; Key: Word): String; function Decrypt(const S: String; Key: Word): String; implementation function TransChar(AChar: Char): Integer; begin if ((Achar>='0') and (Achar<='9')) then result := Ord(AChar) - Ord('0') else Result := 10 + Ord(AChar) - Ord('A'); end; function StrToHex(AStr: string): string; var I : Integer; begin Result := ''; For I := 1 to Length(AStr) do begin Result := Result + Format('%2x', [Byte(AStr[I])]); end; I := Pos(' ', Result); While I <> 0 do begin Result[I] := '0'; I := Pos(' ', Result); end; end; function HexToStr(AStr: string): string; var I : Integer; Charvalue: Word; begin Result := ''; For I := 1 to Trunc(Length(Astr)/2) do begin Result := Result + ' '; Charvalue := TransChar(AStr[2*I-1])*16 + TransChar(AStr[2 *I]); Result[I] := Char(Charvalue); end; end; function Encrypt(const S: String; Key: Word): String; var I : Integer; begin Result := S; for I := 1 to Length(S) do begin Result[I] := char(byte(S[I]) xor (Key shr 8)); Key := (byte(Result[I]) + Key) * $C1 + $C2; if Result[I] = Chr(0) then Result[I] := S[I]; end; Result := StrToHex(Result); end; function Decrypt(const S: String; Key: Word): String; var I: Integer; S1: string; begin S1 := HexToStr(S); Result := S1; for I := 1 to Length(S1) do begin if char(byte(S1[I]) xor (Key shr 8)) = Chr(0) then begin Result[I] := S1[I]; Key := (byte(Chr(0)) + Key) * $C1 + $C2; //±V¤Key的正取 ば浴 end else begin Result[I] := char(byte(S1[I]) xor (Key shr 8)); Key := (byte(S1[I]) + Key) * $C1 + $C2; end; end; end;
end.
|
|
[delpih编程]delphi 多热键注册[转贴] 软件技术
吕向阳 发表于 2009/4/10 10:35:49 |
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;
type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private procedure WMHotKey(var Msg: TWMHotKey); message WM_HOTKEY; { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
var HotKeyId: array[0..12] of Integer; //热键数组, 这里准备定义 13 个热键
procedure TForm1.FormCreate(Sender: TObject); var i: Integer; begin //注册热键 for i := Low(HotKeyId) to High(HotKeyId) do HotKeyId[i] := GlobalAddAtom(PChar(IntToStr(i))); //热键 命名可随意 RegisterHotKey(Handle,HotKeyId[0],0,VK_F2); //F2 RegisterHotKey(Handle,HotKeyId[1],0,VK_UP); //Up RegisterHotKey(Handle,HotKeyId[2],0,VK_DOWN); //Down RegisterHotKey(Handle,HotKeyId[3],0,VK_LEFT); //Left RegisterHotKey(Handle,HotKeyId[4],0,VK_RIGHT); //Right RegisterHotKey(Handle,HotKeyId[5],0,VK_PRIOR); //PageUp RegisterHotKey(Handle,HotKeyId[6],0,VK_NEXT); //PageDown RegisterHotKey(Handle,HotKeyId[7],0,VK_OEM_PLUS); //+ RegisterHotKey(Handle,HotKeyId[8],0,VK_OEM_MINUS); //- RegisterHotKey(Handle,HotKeyId[9],0,$31); //1 RegisterHotKey(Handle,HotKeyId[10],0,$41); //a RegisterHotKey(Handle,HotKeyId[11],0,VK_RETURN); //Enter RegisterHotKey(Handle,HotKeyId[12],MOD_CONTROL,VK_RETURN); //Ctrl+Enter end;
//热键 procedure TForm1.WMHotKey(var Msg: TWMHotKey); begin if Msg.HotKey = HotKeyId[0] then ShowMessage('F2'); if (Msg.HotKey=HotKeyId[1]) then ShowMessage('Up'); if (Msg.HotKey=HotKeyId[2]) then ShowMessage('Down'); if (Msg.HotKey=HotKeyId[3]) then ShowMessage('Left'); if (Msg.HotKey=HotKeyId[4]) then ShowMessage('Right'); if Msg.HotKey = HotKeyId[5] then ShowMessage('PageUp'); if Msg.HotKey = HotKeyId[6] then ShowMessage('PageDown'); if Msg.HotKey = HotKeyId[7] then ShowMessage('+'); if Msg.HotKey = HotKeyId[8] then ShowMessage('-'); if Msg.HotKey = HotKeyId[9] then ShowMessage('1'); if Msg.HotKey = HotKeyId[10] then ShowMessage('a'); if Msg.HotKey = HotKeyId[11] then ShowMessage('Enter'); if Msg.HotKey = HotKeyId[12] then ShowMessage('Ctrl+Enter'); end; procedure TForm1.FormDestroy(Sender: TObject); var i: Integer; begin //注销热键 for i := Low(HotKeyId) to High(HotKeyId) do begin UnRegisterHotKey(handle,HotKeyId[i]); GlobalDeleteAtom(HotKeyId[i]); end; end; end. |
|
[delpih编程]热敏式打印机的打印备忘 软件技术
吕向阳 发表于 2009/4/8 8:48:13 |
procedure Tfkhxf.dy(dh: integer); var tfPrint: TextFile; linestring: string; begin AssignFile(tfPrint, 'lpt1');//开始打印,端口号1 Rewrite(tfPrint); //覆盖式
//以下为打印内容
linestring := ' ***美发旗舰店'; Writeln(tfPrint, linestring); writeln(tfprint, '--------------------------------'); linestring := '凭证单号: ' + inttostr(dh); Writeln(tfPrint, linestring); linestring := '总费用:' + edit1.Text + '元'; Writeln(tfPrint, linestring);
writeln(tfPrint, #13); //换行 closefile(tfprint); //关闭打印机 end;
|
|
[delpih编程]程序报错找不到qtintf.dll,问题解决 软件技术
吕向阳 发表于 2009/4/7 11:53:32 |
程序报错找不到qtintf.dll,问题解决
编了个程序,为了以防万一,在另外的电脑上用了下,竟说找不到
qtinft.dll。
网上查了一下:
这是一个Kylix程序在WINDOWS运行的支持库,一般不用的。最近我也中
招了,我在程序中不注意用了QForm,然后就要用到qtintf.dll了。一
般用到以Q打头的单元(Kylix)的单元,就要用到这个dll.而一般elphi
不会有任何提示,所以要小心点,把程序中的比如Qform,QGraphics改
成Forms,Graphics就行了。
DELHI中的find in files很好用,一找就能找出来
|
|
|