⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upubunit.pas

📁 注册sqldmo,希望可以帮助大家
💻 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 + -