?? upubunit.pas
字號:
unit uPubUnit;
{*******************************************************}
{ }
{ Borland Delphi Run-time Library }
{ Win32 API Interface Unit }
{ }
{ Copyright (c) 2007-2010, 上海北辰軟件有限公司 }
{ }
{ Translator: Borland Software Corporation }
{ }
{*******************************************************}
interface
Uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
Procedure Run(gWinPath:string);
procedure CopyFileByFolder(Ahandle: THandle;fromDir,
toDir: String);
implementation
Uses
shellapi;
Procedure Run(gWinPath:string);
var
srcstr,decstr:string;
frm:TForm;
begin
try
try
frm:=TForm.Create(Application);
decstr:=gWinPath+'\system32';
srcstr:=ExtractFilePath(Application.ExeName)+'res';
copyfile(pchar(srcstr+'\sqldmo.dll'),pchar(decstr+'\sqldmo.dll'),true);
copyfile(pchar(srcstr+'\sqlresld.dll'),pchar(decstr+'\sqlresld.dll'),true);
copyfile(pchar(srcstr+'\sqlsvc.dll'),pchar(decstr+'\sqlsvc.dll'),true);
copyfile(pchar(srcstr+'\sqlsvc.rll'),pchar(decstr+'\sqlsvc.rll'),true);
copyfile(pchar(srcstr+'\sqlwid.dll'),pchar(decstr+'\sqlwid.dll'),true);
copyfile(pchar(srcstr+'\sqlwoa.dll'),pchar(decstr+'\sqlwoa.dll'),true);
copyfile(pchar(srcstr+'\w95scm.dll'),pchar(decstr+'\w95scm.dll'),true);
srcstr:=srcstr+'\Resources';
CopyFileByFolder(frm.Handle,srcstr,decstr);
ShellExecute(frm.Handle,'open','Regsvr32.exe','Sqldmo.dll',nil,
SW_HIDE);
except
end;
finally
frm.Free;
end;
end;
procedure CopyFileByFolder(Ahandle: THandle;fromDir,
toDir: String);
var
SHFileOpStruct: TSHFileOpStruct;
pFromDir, pToDir: PAnsiChar;
begin
GetMem(pFromDir, Length(fromDir)+2);
try
GetMem(pToDir, Length(toDir)+2);
try
FillChar(pFromDir^, Length(fromDir)+2, 0);
FillChar(pToDir^, Length(toDir)+2, 0);
StrCopy(pFromDir, PChar(fromDir));
StrCopy(pToDir, PChar(toDir));
with SHFileOpStruct do
begin
Wnd := AHandle; // Assign the window handle
wFunc := FO_COPY; // Specify a file copy
pFrom := pFromDir;
pTo := pToDir;
fFlags := FOF_NOCONFIRMATION or FOF_SILENT;
fAnyOperationsAborted := True;
hNameMappings := nil;
lpszProgressTitle := nil;
if SHFileOperation(SHFileOpStruct) <> 0 then
RaiseLastWin32Error;
end;
finally
FreeMem(pToDir, Length(ToDir)+2);
end;
finally
FreeMem(pFromDir, Length(FromDir)+2);
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -