diff --git a/WinDevice.sln.DotSettings.user b/WinDevice.sln.DotSettings.user
new file mode 100644
index 0000000..65fbad0
--- /dev/null
+++ b/WinDevice.sln.DotSettings.user
@@ -0,0 +1,3 @@
+
+ SOLUTION
+
\ No newline at end of file
diff --git a/WinDevice/Utils/CmdUtil.cpp b/WinDevice/Utils/CmdUtil.cpp
index e9c9a2d..c72a679 100644
--- a/WinDevice/Utils/CmdUtil.cpp
+++ b/WinDevice/Utils/CmdUtil.cpp
@@ -1,15 +1,49 @@
#include "CmdUtil.h"
+#include
-#include
#include
#include
#include
-#include
+#include
using namespace std;
std::string CmdUtil::ExecuteCommand(const std::string& command)
{
+ spdlog::info("ExecuteCommand command:{0}", command);
+ auto cmd_result = std::string();
+ char psBuffer[0x2000] = { 0 };
+ FILE* pPipe;
- return "";
+ /* Run DIR so that it writes its output to a pipe. Open this
+ * pipe with read text attribute so that we can read it
+ * like a text file.
+ */
+
+ if ((pPipe = _popen(command.c_str(), "rt")) == NULL)
+ {
+ exit(1);
+ }
+
+ /* Read pipe until end of file, or an error occurs. */
+
+ while (fgets(psBuffer, 0x2000, pPipe))
+ {
+ cmd_result += psBuffer;
+ memset(psBuffer, 0, 0x2000);
+ }
+
+ int endOfFileVal = feof(pPipe);
+ int closeReturnVal = _pclose(pPipe);
+
+ if (endOfFileVal)
+ {
+ spdlog::info("ExecuteCommand, Process returned {0}", closeReturnVal);
+ }
+ else
+ {
+ spdlog::error("ExecuteCommand Error: Failed to read the pipe to the end");
+ }
+ spdlog::info("ExecuteCommand result: {0}", cmd_result);
+ return cmd_result;
}
diff --git a/WinDevice/Utils/CmdUtil.h b/WinDevice/Utils/CmdUtil.h
index d195c68..1c6f4e8 100644
--- a/WinDevice/Utils/CmdUtil.h
+++ b/WinDevice/Utils/CmdUtil.h
@@ -1,12 +1,8 @@
-
-#include
-#include
-#include
+#pragma once
#include
-#include
class CmdUtil
{
public:
static std::string ExecuteCommand(const std::string& command);
-};
+};
\ No newline at end of file
diff --git a/WinDevice/Utils/SysInfoUtil.cpp b/WinDevice/Utils/SysInfoUtil.cpp
index d514c88..9e281e6 100644
--- a/WinDevice/Utils/SysInfoUtil.cpp
+++ b/WinDevice/Utils/SysInfoUtil.cpp
@@ -264,7 +264,7 @@ int SysInfoUtil::GetInfoByEnumDisplayDevices()
return 0;
}
-void SysInfoUtil::GetInfoByEnumDisplayDevicesA()
+void GetInfoByEnumDisplayDevicesA()
{
DISPLAY_DEVICEA dd;
DEVMODEA dm;
diff --git a/WinDevice/Utils/TimeUtil.cpp b/WinDevice/Utils/TimeUtil.cpp
new file mode 100644
index 0000000..6a45c19
--- /dev/null
+++ b/WinDevice/Utils/TimeUtil.cpp
@@ -0,0 +1,14 @@
+#include "TimeUtil.h"
+#include
+
+
+template
+void TimeUtil::CalExecuteTime(Func func)
+{
+ // 测量函数调用的耗时
+ const auto start = std::chrono::high_resolution_clock::now();
+
+ const auto end = std::chrono::high_resolution_clock::now();
+ const auto duration = std::chrono::duration_cast(end - start);
+ spdlog::info("Function call duration: {0} ms", duration.count());
+}
diff --git a/WinDevice/Utils/TimeUtil.h b/WinDevice/Utils/TimeUtil.h
new file mode 100644
index 0000000..92f94d5
--- /dev/null
+++ b/WinDevice/Utils/TimeUtil.h
@@ -0,0 +1,8 @@
+#pragma once
+template
+
+class TimeUtil
+{
+public:
+ static void CalExecuteTime(Func func);
+};
diff --git a/WinDevice/Video/ScreenManager.h b/WinDevice/Video/ScreenManager.h
index 5a003d8..fea840d 100644
--- a/WinDevice/Video/ScreenManager.h
+++ b/WinDevice/Video/ScreenManager.h
@@ -2,6 +2,8 @@
#include
#include