📄 project1.dpr
字号:
program Project1;
uses
Forms,
windows,
messages,
SysUtils,
Dialogs,
Unit1 in 'Unit1.pas' {Form1},
Save2 in 'Save2.pas' {Form3},
Splash in 'Splash.pas' {Form2};
{$R *.res}
const
CM_RESTORE =WM_USER + $1000; {自定义的“恢复”消息}
MYAPPNAME ='VLAN录音记录监督台';
type
TDLLRegisterServer=Function:HRESULT;STDCALL;
var
RvHandle : hWnd;
//ATOM:TAtom;
OCXHand:THandle;
RegFunc:TDLLRegisterServer;{Use Activex Or OleCtl}
begin
RvHandle := FindWindow(MYAPPNAME, NIL);
if RvHandle > 0 then
begin
// Atom:=(GlobalAddAtom(pchar(ParamStr(1))));
SendMessage(RvHandle,CM_RESTORE,0,0);
// GlobalDeleteAtom(Atom);
SetForegroundWindow(RvHandle);
exit;
end
else
begin
//ShellExecuteA(application.Handle ,'open','Regsvr32.EXE',Pchar(ExtractFilePath(Application.ExeName)+'PlayClient.ocx /s'),nil,SW_SHOW);
//sleep(400);
///ocx register
try
if Not FileExists(Pchar((ExtractFilePath(Application.ExeName)+'PlayClient.ocx'))) then
begin
showmessage('程序无法运行, 请将PlayClient.ocx复制到'+Pchar(ExtractFilePath(Application.ExeName))+'目录下');
exit;
end;
OcxHand:=LoadLibrary(Pchar((ExtractFilePath(Application.ExeName)+'PlayClient.ocx')));
RegFunc:=GetProcAddress(OcxHand,'DllRegisterServer');
OcxHand:=LoadLibrary(Pchar((ExtractFilePath(Application.ExeName)+'MonitorClient.ocx')));
RegFunc:=GetProcAddress(OcxHand,'DllRegisterServer');
if RegFunc<>0 then
// showmessage('error');
//Application.MessageBox (Pchar('注册ocx失败,请手工注册ocx.命令行如下:开始菜单---运行,输入regsvr32 '+(ExtractFilePath(Application.ExeName)+'PlayClient.ocx')),'提示',MB_OK);
// Form3:=TForm3.Create(Application);;
// Form3.Show;
Finally
FreeLibrary(ocxhand);
end;
///
Application.Initialize;
//Form2:=TForm2.Create(Application);;
//Form2.Show;
//Form2.Update;
// Application.Title := MYAPPNAME;
Application.Title := 'VLAN录音记录监督台';
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.Run;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -