Delphi关联文件扩展名
unit unitMain;
interface
uses
Registry, shlobj,
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TExtForm = class(TForm)
ledExtension: TLabeledEdit;
ledAssocApp: TLabeledEdit;
GetAssocApp: TButton;
AssocThisButton: TButton;
procedure FormCreate(Sender: TObject);
procedure AssocThisButtonClick(Sender: TObject);
procedure GetAssocAppClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ExtForm: TExtForm;
implementation
{$R *.dfm}
function GetExeByExtension(sExt : string) : string;
var
sExtDesc:string;
begin
with TRegistry.Create do
begin
try
RootKey:=HKEY_CLASSES_ROOT;
if OpenKeyReadOnly(sExt) then
begin
sExtDesc:=ReadString('') ;
CloseKey;
end;
if sExtDesc <>'' then
begin
if OpenKeyReadOnly(sExtDesc + '\Shell\Open\Command') then
begin
Result:= ReadString('') ;
end
end;
finally
Free;
end;
end;
if Result <> '' then
begin
if Result[1] = '"' then
begin
Result:=Copy(Result,2,-1 + Pos('"',Copy(Result,2,MaxINt))) ;
end
end;
end;
procedure RegisterFileType(ExtName:String; AppName:String) ;
var
reg:TRegistry;
begin
reg := TRegistry.Create;
try
reg.RootKey:=HKEY_CLASSES_ROOT;
reg.OpenKey('.' + ExtName, True) ;
reg.WriteString('', ExtName + 'file') ;
reg.CloseKey;
reg.CreateKey(ExtName + 'file') ;
reg.OpenKey(ExtName + 'file\DefaultIcon', True) ;
reg.WriteString('', AppName + ',0') ;
reg.CloseKey;
reg.OpenKey(ExtName + 'file\shell\open\command', True) ;
reg.WriteString('',AppName+' "%1"') ;
reg.CloseKey;
finally
reg.Free;
end;
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil) ;
end;
procedure TExtForm.FormCreate(Se
相关文档:
URL: http://edn.embarcadero.com/article/27568
Abstract: Delphi 6 introduces support for COM+ object pooling, which can provide significant performance improvements under some circumstances. We take a look at Delphi 6s object pooling support. By Vincent Parrett.
Typically, when a client appl ......
procedure TForm_BaseMDI.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SendMessage(Handle, 48384, 9, 0);
end;
end; ......
Borland出品的Delphi,有着闪电般的编译速度,但是在界面控件使用较多、工程项目较大的时候,编译一个工程仍需要一段时间,打开庞大的Delphi IDE,也需要时间。其实,在一个工程开发结束,调试完成之后的Release编译,完全可以用命令行来执行,因为Delphi的编译器参数不像C++编译器那样复杂。
笔者把Delphi联机手册 ......
//参考地址:http://www.wangchao.net.cn/bbsdetail_41190.html
一、微软RegExp
1. 下载并安装最新版的"Microsoft(r) Windows(r) Script"
2. RegExp包含在vbscript.dll中所以我们必须先注册regsvr32 vbscript.dll
注(安装了Ie5后默认已经包含该控件)
3.在Delph ......