C
cfhi
Unregistered / Unconfirmed
GUEST, unregistred user!
这是一个FLASH.OCX和WMP.DLL展开和注册的程序,不知为什么在注册成功后就退出了,而不继续执行Application.Run;请大侠给予指点!
代码如下:
program Project1;
uses
Forms,Dialogs, comobj, windows, classes, sysutils, ShellAPI,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
{$R FLASH.RES}
{$R WMP.res}
var
aSystemDirZ : array[0..2047] of Char;
fSystemDir : String;
ResStream1,ResStream2 : TResourceStream;
FileStream1,FileStream2 : TFileStream;
begin
GetSystemDirectory ( aSystemDirZ, 2047 );
fSystemDir := aSystemDirZ;
Application.Initialize;
try
Application.CreateForm(TForm1, Form1);
except
On EOleSysError Do
begin
ResStream1 := TResourceStream.Create(0, 'Flash', RT_RCDATA);
ResStream2 := TResourceStream.Create(0, 'WMP', RT_RCDATA);
try
FileStream1 := TFileStream.Create(fSystemDir+'/macromed/flash/FLASH.OCX', fmCreate);
FileStream2 := TFileStream.Create(fSystemDir+'/WMP.DLL', fmCreate);
try
FileStream1.CopyFrom(ResStream1, 0);
FileStream2.CopyFrom(ResStream2, 0);
finally
FileStream1.Free;
FileStream2.Free;
end;
finally
ResStream1.Free;
ResStream2.Free;
end;
ShellExecute(33,NIL,'regsvr32.exe ','c:/windows/system32/macromed/flash/flash.ocx',NIL,SW_SHOW);
ShellExecute(33,NIL,'regsvr32.exe ','c:/windows/system32/wmp.dll',NIL,SW_SHOW);
end;
end;
//到此为止就退出了!不知为什么!
Application.Run;//没执行!
end.
代码如下:
program Project1;
uses
Forms,Dialogs, comobj, windows, classes, sysutils, ShellAPI,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
{$R FLASH.RES}
{$R WMP.res}
var
aSystemDirZ : array[0..2047] of Char;
fSystemDir : String;
ResStream1,ResStream2 : TResourceStream;
FileStream1,FileStream2 : TFileStream;
begin
GetSystemDirectory ( aSystemDirZ, 2047 );
fSystemDir := aSystemDirZ;
Application.Initialize;
try
Application.CreateForm(TForm1, Form1);
except
On EOleSysError Do
begin
ResStream1 := TResourceStream.Create(0, 'Flash', RT_RCDATA);
ResStream2 := TResourceStream.Create(0, 'WMP', RT_RCDATA);
try
FileStream1 := TFileStream.Create(fSystemDir+'/macromed/flash/FLASH.OCX', fmCreate);
FileStream2 := TFileStream.Create(fSystemDir+'/WMP.DLL', fmCreate);
try
FileStream1.CopyFrom(ResStream1, 0);
FileStream2.CopyFrom(ResStream2, 0);
finally
FileStream1.Free;
FileStream2.Free;
end;
finally
ResStream1.Free;
ResStream2.Free;
end;
ShellExecute(33,NIL,'regsvr32.exe ','c:/windows/system32/macromed/flash/flash.ocx',NIL,SW_SHOW);
ShellExecute(33,NIL,'regsvr32.exe ','c:/windows/system32/wmp.dll',NIL,SW_SHOW);
end;
end;
//到此为止就退出了!不知为什么!
Application.Run;//没执行!
end.