to wjiachun: 也许我没说清楚,我说的是“WINDOWS如何启动屏保”,即在“Control Panel”设置的,SHELLEXECUTE虽可启动屏保,却不能启动先前设置的屏保,如何获得这一屏保的文件名?
是利用程序的参数,我是这样做的: Mutex:=CreateMutex(NIL,True,'SingleApp'); IF GetLastError<>ERROR_ALREADY_EXISTS THEN//如果不存在另一实例 BEGIN
Tag:=0; if LowerCase(ParamStr(1))='/a' then Tag:=1 else if LowerCase(ParamStr(1))='/p' then Tag:=2 else if LowerCase(ParamStr(1))='/c' then Tag:=3 else if LowerCase(ParamStr(1))='/s' then Tag:=4; // /a 在显示属性对话框中单击他就可以修改口令 // /p 每当选中显示属性对话框中屏幕保护程序标签时,在对话框显示预览效果 // /c 在显示属性对话框中单击他进行设置 // /s 在显示属性对话框中单击预览按钮或系统掉用屏保 case Tag of 4: begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end; 0,1,3: begin Application.Initialize; Application.CreateForm(TForm2, Form2); Application.Run; end; end;
是利用程序的参数,我是这样做的: Mutex:=CreateMutex(NIL,True,'SingleApp'); IF GetLastError<>ERROR_ALREADY_EXISTS THEN//如果不存在另一实例 BEGIN
Tag:=0; if LowerCase(ParamStr(1))='/a' then Tag:=1 else if LowerCase(ParamStr(1))='/p' then Tag:=2 else if LowerCase(ParamStr(1))='/c' then Tag:=3 else if LowerCase(ParamStr(1))='/s' then Tag:=4; // /a 在显示属性对话框中单击他就可以修改口令 // /p 每当选中显示属性对话框中屏幕保护程序标签时,在对话框显示预览效果 // /c 在显示属性对话框中单击他进行设置 // /s 在显示属性对话框中单击预览按钮或系统掉用屏保 case Tag of 4: begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end; 0,1,3: begin Application.Initialize; Application.CreateForm(TForm2, Form2); Application.Run; end; end;END; ReleaseMutex(Mutex);end.
是利用程序的参数,我是这样做的: Mutex:=CreateMutex(NIL,True,'SingleApp'); IF GetLastError<>ERROR_ALREADY_EXISTS THEN//如果不存在另一实例 BEGIN
Tag:=0; if LowerCase(ParamStr(1))='/a' then Tag:=1 else if LowerCase(ParamStr(1))='/p' then Tag:=2 else if LowerCase(ParamStr(1))='/c' then Tag:=3 else if LowerCase(ParamStr(1))='/s' then Tag:=4; // /a 在显示属性对话框中单击他就可以修改口令 // /p 每当选中显示属性对话框中屏幕保护程序标签时,在对话框显示预览效果 // /c 在显示属性对话框中单击他进行设置 // /s 在显示属性对话框中单击预览按钮或系统掉用屏保 case Tag of 4: begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end; 0,1,3: begin Application.Initialize; Application.CreateForm(TForm2, Form2); Application.Run; end; end;END; ReleaseMutex(Mutex);end.其实屏保程序就是一个exe,只是扩展名不同
也许我没说清楚,我说的是“WINDOWS如何启动屏保”,即在“Control Panel”设置的,SHELLEXECUTE虽可启动屏保,却不能启动先前设置的屏保,如何获得这一屏保的文件名?
Mutex:=CreateMutex(NIL,True,'SingleApp');
IF GetLastError<>ERROR_ALREADY_EXISTS THEN//如果不存在另一实例
BEGIN
Tag:=0;
if LowerCase(ParamStr(1))='/a' then
Tag:=1
else if LowerCase(ParamStr(1))='/p' then
Tag:=2
else if LowerCase(ParamStr(1))='/c' then
Tag:=3
else if LowerCase(ParamStr(1))='/s' then
Tag:=4;
// /a 在显示属性对话框中单击他就可以修改口令
// /p 每当选中显示属性对话框中屏幕保护程序标签时,在对话框显示预览效果
// /c 在显示属性对话框中单击他进行设置
// /s 在显示属性对话框中单击预览按钮或系统掉用屏保
case Tag of
4:
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end; 0,1,3:
begin
Application.Initialize;
Application.CreateForm(TForm2, Form2);
Application.Run;
end; end;
Mutex:=CreateMutex(NIL,True,'SingleApp');
IF GetLastError<>ERROR_ALREADY_EXISTS THEN//如果不存在另一实例
BEGIN
Tag:=0;
if LowerCase(ParamStr(1))='/a' then
Tag:=1
else if LowerCase(ParamStr(1))='/p' then
Tag:=2
else if LowerCase(ParamStr(1))='/c' then
Tag:=3
else if LowerCase(ParamStr(1))='/s' then
Tag:=4;
// /a 在显示属性对话框中单击他就可以修改口令
// /p 每当选中显示属性对话框中屏幕保护程序标签时,在对话框显示预览效果
// /c 在显示属性对话框中单击他进行设置
// /s 在显示属性对话框中单击预览按钮或系统掉用屏保
case Tag of
4:
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end; 0,1,3:
begin
Application.Initialize;
Application.CreateForm(TForm2, Form2);
Application.Run;
end;
end;END;
ReleaseMutex(Mutex);end.
SendMessage(HWND_BROADCAST,WM_SYSCOMMAND,SC_SCREENSAVE,0);
Mutex:=CreateMutex(NIL,True,'SingleApp');
IF GetLastError<>ERROR_ALREADY_EXISTS THEN//如果不存在另一实例
BEGIN
Tag:=0;
if LowerCase(ParamStr(1))='/a' then
Tag:=1
else if LowerCase(ParamStr(1))='/p' then
Tag:=2
else if LowerCase(ParamStr(1))='/c' then
Tag:=3
else if LowerCase(ParamStr(1))='/s' then
Tag:=4;
// /a 在显示属性对话框中单击他就可以修改口令
// /p 每当选中显示属性对话框中屏幕保护程序标签时,在对话框显示预览效果
// /c 在显示属性对话框中单击他进行设置
// /s 在显示属性对话框中单击预览按钮或系统掉用屏保
case Tag of
4:
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end; 0,1,3:
begin
Application.Initialize;
Application.CreateForm(TForm2, Form2);
Application.Run;
end;
end;END;
ReleaseMutex(Mutex);end.其实屏保程序就是一个exe,只是扩展名不同