unit unitFileOP;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
implementation
function GetSys32Dir:String;
var
Sys32Dir: string;
pSys32Dir: array[0..Max_Path] of char;
begin
GetSystemDirectory(pSys32Dir,Max_Path);
Sys32Dir := String(pSys32Dir) + chr(92);
Result := Sys32Dir;
end;
procedure MyFileCopy(const fromFile, ToFile: string);
var
fromF, ToF: file;
NumRead, NumWritten: integer;
Buf: array[1..2048] of Char;
begin
AssignFile(fromF, fromFile);
Reset(fromF, 1);
AssignFile(ToF, ToFile);
Rewrite(ToF, 1);
repeat
BlockRead(fromF, Buf, SizeOf(Buf), NumRead);
BlockWrite(ToF, Buf, NumRead, NumWritten);
until (NumRead = 0) or (NumWritten <> NumRead);
CloseFile(fromF);
CloseFile(ToF);
end;
function GetExeFileVersion(fn: string; var ma, mi, r, b: integer): boolean;
var
buf, p: pChar;
sver: ^VS_FIXEDFILEINFO;
i: LongWord;
begin
i := GetFileVersionInfoSize(pchar(fn), i);
new(sver);
p := pchar(sver);
GetMem(buf, i);
ZeroMemory(buf, i);
result := false;
if GetFileVersionInfo(pchar(fn), 0, 4096, pointer(buf)) then
if VerQueryValue(buf, '\', pointer(sver), i) then
begin
ma := sVer^.dwFileVersionMS shr 16;
mi := sver^.dwFileVersionMS and $0000FFFF;
r := sver^.dwFileVersionLS shr 16;
b := sver^.dwFileVersionLS and $0000FFFF;
result := true;
end;
Dispose(p);
FreeMem(buf);
end;
function GetVersionString(const pFileName: string): string;
var
VerInfoSize: DWORD;
VerInfo: Pointer;
VerValueSize: DWORD;
Dummy: DWORD;
VerValue: PVSFixedFileInfo;
begin
Result := '0';
VerInfoSize := GetFileVersionInfoSize(PChar(pFileName), Dummy);
if VerInfoSize = 0 then
Exit;
GetMem(VerInfo, VerInfoSize);
GetFileVersionInfo(PChar(pFileName), 0, VerInfoSize, VerInfo);
VerQueryValue(VerInfo, chr(92), Pointer(VerValue), VerValueSize);
今天在大理剑川做监控联网工程,遇到2台DIY的PC-DVR,联网很不顺利。机器的软件是盗版破解的,只破解了服务器端,客户端未破解,还有就是版本也不对。最后发现软件下有一ActiveX控件可以做联网使用,于是想把这个OCX引入项目软件工程。在引入的时候delphi提示coreide70.bpl报错,错误代码:00000019 ......