ソースを参照

!2 add prestart cef

chenliangyu 1 年間 前
コミット
6a3d29d9ac

+ 2 - 0
Framework/spbase/sp_cfg.cpp

@@ -41,6 +41,7 @@
 #include <ctime>
 #include <sstream>
 #include <iomanip>
+#include <windows.h>
 #define UPDATE_ROOT_BY_HTTP
 #else
 #include "JsonConvertHelper.hpp"
@@ -48,6 +49,7 @@
 #include "sp_checkEntity.h"
 
 
+
 #if defined(_MSC_VER)
 
 std::map<std::string, std::string> g_specialRunInfoArr;

+ 16 - 0
Framework/spbase/sp_runTask.cpp

@@ -121,6 +121,22 @@ int sp_runtask_killprocess()
 	return 0;
 }
 
+void sp_tryquickStartCef()
+{
+#if defined(RVC_OS_WIN)
+	char tmp[MAX_PATH];
+	GetModuleFileNameA(NULL, tmp, MAX_PATH);
+	*strrchr(tmp, SPLIT_SLASH) = 0;
+	sprintf(tmp, "%s" SPLIT_SLASH_STR "Chromium" SPLIT_SLASH_STR "cefclient.exe", tmp);
+	if (!ExistsFile(tmp))
+	{
+		std::string cmd = tmp;
+		cmd.append(" --listpeers");
+		WinExec(cmd.c_str(), SW_HIDE);
+	}
+#endif
+}
+
 int sp_runtask_loadLogLevel()
 {
 	sp_tryRefreshLogLevelFromCacheConfig();

+ 1 - 0
Framework/spbase/sp_runTask.h

@@ -10,6 +10,7 @@ extern "C" {
 	SPBASE_API int sp_runtask_killprocess();
 	SPBASE_API int sp_runtask_startprocess();
 	SPBASE_API int sp_runtask_loadLogLevel();
+	SPBASE_API void sp_tryquickStartCef();
 
 #ifdef __cplusplus
 } // extern "C" {

+ 1 - 0
Framework/spshell/spshell.cpp

@@ -1084,6 +1084,7 @@ int main(int argc, char** argv)
 	}
 #endif //_MSC_VER
 	sp_runtask_loadLogLevel();
+	sp_tryquickStartCef();
     create_log_producer_default("SpShell", 0);
     DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("===================SpShell start=====================");
     DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("process id: %d, saveFile:%d", GetCurrentProcessId(), saveFile);