随笔分类 - 公用函数源码
枚举串口
摘要:procedure EnumComPorts(Ports: TStrings);var KeyHandle: HKEY; ErrCode, Index: Integer; ValueName, Data: string; ValueLen, DataLen, ValueType: DWORD; TmpPorts: TStringList;begin ErrCode := RegOpenKeyEx( HKEY_LOCAL_MACHINE, 'HARDWARE\DEVICEMAP\SERIALCOMM', 0, KEY_READ, KeyHandle); if ErrCode ERROR_S
阅读全文
进制转换
摘要:{*******************************************************}{ }{进制转换 }{ }{ cxg 2008-08-23 08:52:16 }{ }{*******************************************************}unit uStrUnit;interfaceuses SysUtils, StrUtils, Windows, Classes, WinSock, Forms, Controls, Dialogs;const cHexBinStrings: array[0..15] of strin
阅读全文
设置默认输入法
摘要:uses TypInfoprocedure SetImeA(AOwner:TForm);var i:Integer;begin for i := 0 to AOwner.ComponentCount - 1 do begin if GetPropInfo(AOwner.Components[i],'ImeName')nil then begin SetPropValue(AOwner.Components[i],'ImeName', readinifile(getinifile,'ime','imename','')); end; end; end;
阅读全文
图像格式转换
摘要:uses Windows, Messages, SysUtils, Classes, Graphics, JPEG;function BmpToJpeg(Sou:TFileName;Des:TFileName):Boolean; //bmp转换成jpgfunction BmpToEmf(Sou:TFileName;Des:TFileName):Boolean; //bmp转换成emffunction BmpToWmf(Sou:TFileName;Des:TFileName):Boolean; //bmp转换成wmffunction BmpToIcon(Sou:TFileName;Des:Til
阅读全文
Enter键使用作Tab键
摘要:首先,在主窗体中声明以下private过程:procedure TMainForm.DoEnterAsTab(var Msg: TMsg; var Handled: Boolean);beginif Msg.Message = WM_KEYDOWN thenbeginif Msg.wParam = VK_RETURN thenKeybd_event(VK_TAB, 0, 0, 0);end; //ifend;在主窗体的OnCreate事件中加入:Application.OnMessage := DoEnterAsTab;
阅读全文
包含图形、动画、进度条等等的状态栏
摘要:{在Delphi中,一个控件上能否成为其它控件的父控件取决于此控件的ControlStyle属性。ControlStyle属性是集合类型的,如果此集合包含csAcceptsControls元素,则它能接受其它控件;否则,它就不能成为其它控件的父控件。ControlStyle属性只能在控件的构造函数(Constructor)中指定,在程序运行时它是不能被改变的。所以如果希望窗口状态条上面能包含其它控件,我们只需要在继承类中重载TStatusBar控件的Constructor函数,并且让控件的集合属性ControlStyle中包含csAcceptsControls即可。 }unit StatusB
阅读全文
与Access数据库结构有关的一些函数
摘要://与数据库结构有关的一些函数//1、动态改变字段名称uses ComObj;//Access//TableName: 表名; OldColName: 原字段名; NewColName: 新字段名;procedure RenameField(const TableName, OldColName, NewColName: string);var DB, Col: OleVariant;begin DB := CreateOleObject('ADOX.Catalog'); DB.ActiveConnection := ADOConnection1.ConnectionObject; Col :
阅读全文
定时关闭各种对话框
摘要:{*******************************************************}{ }{ 定时关闭各种对话框 }{ }{ 版权所有 (C) 2007 咏南工作室(陈新光) }{ }{*******************************************************}unit uTimerDlg;interfaceuses Windows, Messages, SysUtils, Classes, Forms, ExtCtrls;// 如果指定的时间没有操作对话框,则自动关闭procedure ResetDlgAutoClose;pr
阅读全文
通用打印模块DBGridEh
摘要:{*******************************************************}{ }{ 通用打印模块 } { }{ 版权所有 (C) 2008 咏南工作室(陈新光) }{ }{*******************************************************}unit uPrint;interfaceuses DBGridEh,PrnDbgeh,SysUtils,Graphics,Forms,Printers,windows;procedure Prnt(AGrid:TDBGridEh;AOwner:Tform;APageHead
阅读全文
导出Tdbgrideh数据
摘要:{*******************************************************}{ }{ 导出Tdbgrideh数据 }{ }{ 版权所有 (C) 2007 咏南工作室 }{ }{*******************************************************}unit uExport;interfaceuses DBGridEhImpExp, DBGridEh, SysUtils, Dialogs, ComObj, ActiveX, Variants, db, FormWait;procedure ExpDbgridEh(gri
阅读全文
DES加解密算法
摘要:{*******************************************************}{ }{ DES加解密算法 }{ }{ 版权所有 (C) 2008 咏南工作室(陈新光) }{ }{*******************************************************}unit DESCrypt;interfaceuses SysUtils;function EnCrypt(aStr: string; acKey: string): string;function DeCrypt(aStr: string; acKey: string):
阅读全文
公用函数(1)
摘要:{*******************************************************}{ }{ 公用函数 }{ }{ 版权所有 (C) 2007 咏南工作室 }{ }{*******************************************************}unit uCommFunc;interfaceuses SysUtils, Forms, Windows, Controls, Messages, Dialogs, db, Classes, ComObj,IniFiles,ShellAPI,WinSock;//==============
阅读全文
浙公网安备 33010602011771号