浏览代码

update 8/16 15

XKSYU2021 2 月之前
父节点
当前提交
cfaf087a5b

+ 20 - 15
Ui for BDS/ID.h

@@ -1,32 +1,37 @@
 #pragma once
 
-#define InitH(x) HANDLE x = NULL
-#define InitHWND(x) HWND x = NULL
-
-#define C(x) (x "\n")
-
-extern HANDLE UIw_key, BDSr_key, UIr_log, BDSw_log;
-extern HWND hWnd;
-
-#define TITLE _T("UI for BDS")
 // #define ID_
 
 #define ID_START 10001
 #define ID_STOP 10002
 #define ID_STOP_FORCE 10003
+
 #define ID_CMD_KEY 20001
 #define ID_CMD_OK 20002
 #define ID_CMD_CLEAR 20003
+
 #define ID_FC_Weather 30100
 #define ID_FC_Wea_SET_1 30101
 #define ID_FC_Wea_SET_2 30102
 #define ID_FC_Wea_SET_3 30103
 #define ID_FC_Wea_ADV 30110
 #define ID_FC_Wea_OK 30120
+
 #define ID_FC_Time 30200
-#define ID_FC_Time_SET 30201
-#define ID_FC_Time_ADV 30202
-#define ID_FC_Time_MAN 30203
-#define ID_FC_Time_OK 30210
-#define ID_LOG 40101
-#define ID_LOG_CLEAR 40102
+#define ID_FC_Time_SET_1 30201
+#define ID_FC_Time_SET_2 30202
+#define ID_FC_Time_SET_3 30203
+#define ID_FC_Time_SET_4 30204
+#define ID_FC_Time_SET_5 30205
+#define ID_FC_Time_SET_6 30206
+#define ID_FC_Time_ADV 30210
+#define ID_FC_Time_OK 30220
+
+#define ID_FC_PLAYER 30300
+#define ID_FC_Player_OK 30310
+
+#define ID_FS_WT 40001
+#define ID_FS_LIST 40002
+
+#define ID_LOG 100101
+#define ID_LOG_CLEAR 100102

+ 67 - 184
Ui for BDS/MAIN.cpp

@@ -1,10 +1,11 @@
 #include "Win32.h"
 #include "ID.h"
 #include "Function.h"
+#include "SharedValue.h"
 
 HWND hWnd = NULL;
 
-static HFONT Font()
+HFONT Font()
 {
     HFONT hFont = CreateFont(
         -40,
@@ -123,9 +124,9 @@ int WINAPI WinMain(
 
 
     HWND hLabel_3 = CreateWindow(
-        L"STATIC", L"快捷命令",
+        L"STATIC", L"时间和天气",
         WS_VISIBLE | WS_CHILD,
-        30, 255, 90, 30,
+        30, 255, 110, 30,
         hWnd, NULL,
         (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE), NULL
     );
@@ -143,6 +144,36 @@ int WINAPI WinMain(
         hWnd, (HMENU)ID_FC_Time,
         (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE), NULL
     );
+    HWND hFSwt = CreateWindow(
+        L"BUTTON", L"查询时间和天气",
+        WS_VISIBLE | WS_CHILD,
+        290, 300, 180, 40,
+        hWnd, (HMENU)ID_FS_WT,
+        (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE), NULL
+    );
+   
+
+    HWND hLabel_4 = CreateWindow(
+        L"STATIC", L"在线玩家操作",
+        WS_VISIBLE | WS_CHILD,
+        30, 365, 130, 30,
+        hWnd, NULL,
+        (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE), NULL
+    );
+    HWND hFClevel = CreateWindow(
+        L"BUTTON", L"打开面板",
+        WS_VISIBLE | WS_CHILD,
+        30, 410, 110, 40,
+        hWnd, (HMENU)ID_FC_PLAYER,
+        (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE), NULL
+    );
+    HWND hFSlist = CreateWindow(
+        L"BUTTON", L"查询在线玩家",
+        WS_VISIBLE | WS_CHILD,
+        160, 410, 150, 40,
+        hWnd, (HMENU)ID_FS_LIST,
+        (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE), NULL
+    );
 
     //Font
     HFONT hFont = CreateFont(
@@ -170,12 +201,11 @@ int WINAPI WinMain(
 }
 
 //Behavior of controls
-InitHWND(hTime); 
-InitHWND(hWeather);
-InitHWND(hLog);
+InitHW(hTime);   InitHW(hWeather);   InitHW(hLog);   InitHW(hPlayer);
 LRESULT CALLBACK TimeProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam); 
 LRESULT CALLBACK WeatherProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam);
 LRESULT CALLBACK LogProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam);
+LRESULT CALLBACK PlayerProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam);
 
 LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
@@ -188,7 +218,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
     case WM_CREATE:
     {
         ClearLog();
-        StartBDS();
+        //StartBDS();
         HINSTANCE HI_Log = NULL;
         hLog = CreateLogWindow(
             _T("日志"),
@@ -212,6 +242,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
         switch (wmId)
         {
         case ID_START:
+            ClearLog();
             StartBDS();
             break;
         case ID_STOP:
@@ -226,6 +257,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                 ForceStopBDS();
             }
             break;
+
         case ID_CMD_OK:
         {
             if (GetWindowTextLength(GetDlgItem(hWnd, ID_CMD_KEY)) > 0)
@@ -241,6 +273,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
         case ID_CMD_CLEAR:
             SetWindowText(GetDlgItem(hWnd, ID_CMD_KEY), _T(" "));
             break;
+
         case ID_FC_Weather:
             if (!hWeather)
             {
@@ -257,199 +290,49 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                 HINSTANCE HI_FC_time = NULL;
                 hTime = CreateChildWindow(hWnd,
                     _T("时间控制"),
-                    600, 440,
+                    400, 415,
                     TimeProc, _T("fc_time"), HI_FC_time);
             }
             break;
-        }
-        break;
-    }
-    case WM_DESTROY:
-        StopBDS();
-        PostQuitMessage(0);
-        break;
-    default:
-        return DefWindowProc(hWnd, message, wParam, lParam);
-        break;
-    }
-    return 0;
-}
-
-
-LRESULT CALLBACK WeatherProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam) {
-    switch (msg) {
-    case WM_CREATE:
-    {
-        HFONT hFont1 = Font();
-        HWND hWeaSet = CreateWindow(
-            L"BUTTON", L"基础选项",
-            WS_VISIBLE | WS_CHILD | BS_GROUPBOX,
-            20, 20, 330, 100,
-            hWnd1, NULL,
-            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
-        );
-        HWND hWeaSet_1 = CreateWindow(
-            L"BUTTON", L"晴天",
-            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | WS_GROUP,
-            40, 55, 80, 40,
-            hWnd1, (HMENU)ID_FC_Wea_SET_1,
-            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
-        );
-        HWND hWeaSet_2 = CreateWindow(
-            L"BUTTON", L"雨天",
-            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
-           140, 55, 80, 40,
-            hWnd1, (HMENU)ID_FC_Wea_SET_2,
-            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
-        );
-        HWND hWeaSet_3 = CreateWindow(
-            L"BUTTON", L"雷暴",
-            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
-            240, 55, 80, 40,
-            hWnd1, (HMENU)ID_FC_Wea_SET_3,
-            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
-        );
-
-
-        HWND hLabel_Wea_1 = CreateWindow(
-            L"STATIC", L"高级选项",
-            WS_VISIBLE | WS_CHILD,
-            30, 150, 80, 30,
-            hWnd1, NULL,
-            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
-        );
-
-        HWND hWeaAdv = CreateWindow(
-            L"BUTTON", L"天气更替",
-            WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX ,
-            30, 190, 110, 40,
-            hWnd1, (HMENU)ID_FC_Wea_ADV,
-            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
-        );
-
-
-        HWND hWeaOK = CreateWindow(
-            L"BUTTON", L"提交",
-            WS_VISIBLE | WS_CHILD,
-            250, 250, 110, 40,
-            hWnd1, (HMENU)ID_FC_Wea_OK,
-            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
-        );
-
-        SendMessage(hWeaSet_1, BM_SETCHECK, BST_CHECKED, 0);
-        SendMessage(hWeaAdv, BM_SETCHECK, BST_CHECKED, 0);
-    }
-        break;
-
-    case WM_COMMAND:
-    {
-        WORD wmId = LOWORD(wParam);
-        switch (wmId)
-        {
-        case ID_FC_Wea_OK:
-            if (IsDlgButtonChecked(hWnd1, ID_FC_Wea_ADV) == BST_CHECKED)
-                SendCommand(C("gamerule doWeatherCycle true"));
-            else SendCommand(C("gamerule doWeatherCycle false"));
-
-            if (IsDlgButtonChecked(hWnd1, ID_FC_Wea_SET_1) == BST_CHECKED)
-                SendCommand(C("weather clear"));
-            else if (IsDlgButtonChecked(hWnd1, ID_FC_Wea_SET_2) == BST_CHECKED)
-                SendCommand(C("weather rain"));
-            else SendCommand(C("weather thunder"));
-
-            DestroyWindow(hWnd1);
-
+        case ID_FS_WT:
+            SendCommand(C("time query daytime"));
+            SendCommand(C("weather query"));
             break;
 
-        default:
+        case ID_FC_PLAYER:
+            if (!hPlayer)
+            {
+                HINSTANCE HI_FC_player = NULL;
+                hPlayer = CreateChildWindow(hWnd,
+                    _T("玩家面板"),
+                    400, 370,
+                    PlayerProc, _T("fc_player"), HI_FC_player);
+            }
+            break;
+        case ID_FS_LIST:
+            SendCommand(C("list"));
             break;
         }
         break;
     }
-        
-
     case WM_CLOSE:
-        DestroyWindow(hWnd1);
+        if (MessageBox(hWnd,
+            L"服务端若正在运行,将被一并关闭。", TITLE,
+            MB_OKCANCEL | MB_APPLMODAL | MB_ICONWARNING)
+            == 1)
+        {
+            StopBDS();
+            PostQuitMessage(0);
+        }
         break;
     case WM_DESTROY:
-        hWeather = NULL;
+        PostQuitMessage(0);
         break;
     default:
-        return DefWindowProc(hWnd1, msg, wParam, lParam);
-    }
-    return 0;
-}
-
-LRESULT CALLBACK TimeProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam) {
-    switch (msg) {
-    case WM_CREATE:
-    {
-        HFONT hFont1 = Font();
-        break;
-    }
-    case WM_CLOSE:
-        DestroyWindow(hWnd1);
-        break;
-    case WM_DESTROY:
-        hTime = NULL;
+        return DefWindowProc(hWnd, message, wParam, lParam);
         break;
-    default:
-        return DefWindowProc(hWnd1, msg, wParam, lParam);
     }
     return 0;
 }
 
-LRESULT CALLBACK LogProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-    switch (msg) {
-    case WM_CREATE:
-    {
-        SetTimer(hWnd1, 1, 100, NULL);
-        HFONT hFont1 = Font();
-        HWND hLog = CreateWindow(
-            L"EDIT", L"Null",
-            WS_VISIBLE | WS_CHILD | WS_BORDER | WS_VSCROLL | ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL,
-            30, 30, 910, 510,
-            hWnd1, (HMENU)ID_LOG,
-            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
-        );
-        HWND hLogClear = CreateWindow(
-            L"BUTTON", L"清除日志",
-            WS_VISIBLE | WS_CHILD,
-            790, 570, 110, 40,
-            hWnd1, (HMENU)ID_LOG_CLEAR,
-            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
-        );
-        break;
-    }
-    case WM_COMMAND:
-    {
-        WORD wmId = LOWORD(wParam);
-        switch (wmId)
-        {
-        case ID_LOG_CLEAR:
-            if (MessageBox(hWnd,
-                L"是否要清除所有日志?", TITLE,
-                MB_OKCANCEL | MB_APPLMODAL | MB_ICONWARNING)
-                == 1)
-            {
-                ClearLog();
-                SetWindowText(GetDlgItem(hWnd1, ID_LOG), _T("Null"));
-                break;
-            }
-        }
-    }
-    case WM_TIMER:
-        Log(GetDlgItem(hLog, ID_LOG));
-        break;
-    case WM_CLOSE:
-        break;
-    case WM_DESTROY:
-        KillTimer(hWnd1, 1);
-        hLog = NULL;
-        break;
-    default:
-        return DefWindowProc(hWnd1, msg, wParam, lParam);
-    }
-    return 0;
-}
+

+ 13 - 0
Ui for BDS/SharedValue.h

@@ -0,0 +1,13 @@
+#pragma once
+
+#define InitHA(x) HANDLE x = NULL
+#define InitHW(x) HWND x = NULL
+
+#define C(x) (x "\n")
+
+extern HANDLE UIw_key, BDSr_key, UIr_log, BDSw_log;
+extern HWND hWnd, hLog, hTime, hWeather, hPlayer;
+
+#define TITLE _T("UI for BDS")
+
+#define TEST MessageBox(hWnd,L"Success!",L"step test",MB_OK)

+ 2 - 0
Ui for BDS/Ui for BDS.vcxproj

@@ -132,10 +132,12 @@
     <ClInclude Include="Function.h" />
     <ClInclude Include="Resource.h" />
     <ClInclude Include="ID.h" />
+    <ClInclude Include="SharedValue.h" />
     <ClInclude Include="Win32.h" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="childProc.cpp" />
+    <ClCompile Include="childProcSet.cpp" />
     <ClCompile Include="cmdSend.cpp" />
     <ClCompile Include="errCheck.cpp" />
     <ClCompile Include="log.cpp" />

+ 7 - 1
Ui for BDS/Ui for BDS.vcxproj.filters

@@ -27,6 +27,9 @@
     <ClInclude Include="Function.h">
       <Filter>头文件</Filter>
     </ClInclude>
+    <ClInclude Include="SharedValue.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="MAIN.cpp">
@@ -41,12 +44,15 @@
     <ClCompile Include="cmdSend.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="childProc.cpp">
+    <ClCompile Include="childProcSet.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
     <ClCompile Include="log.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
+    <ClCompile Include="childProc.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="Ui for BDS.rc">

+ 1 - 1
Ui for BDS/Win32.h

@@ -1,13 +1,13 @@
 #pragma once
 
 #include <windows.h>
+
 #include <stdlib.h>
 #include <string.h>
 #include <tchar.h>
 #include <iostream>
 #include <fstream>
 
-#define TEST MessageBox(hWnd,L"Success!",L"step test",MB_OK)
 
 #ifdef _UNICODE
 #if defined _M_IX86

+ 345 - 60
Ui for BDS/childProc.cpp

@@ -1,67 +1,352 @@
 #include "Win32.h"
 #include "ID.h"
 #include "Function.h"
+#include "SharedValue.h"
 
-HWND CreateChildWindow(HWND hFather, LPCWCHAR childTitle ,int x, int y, WNDPROC procFunc, LPCWCHAR className, HINSTANCE hInstanceF)
-{
-    HWND hChild = NULL;
-    static WNDCLASSEX wcexF;
-    wcexF.cbSize = sizeof(WNDCLASSEX);
-    wcexF.style = CS_HREDRAW | CS_VREDRAW;
-    wcexF.lpfnWndProc = procFunc;
-    wcexF.cbClsExtra = 0;
-    wcexF.cbWndExtra = 0;
-    wcexF.hInstance = hInstanceF;
-    wcexF.hIcon = LoadIcon(wcexF.hInstance, IDI_APPLICATION);
-    wcexF.hCursor = LoadCursor(NULL, IDC_ARROW);
-    wcexF.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
-    wcexF.lpszMenuName = NULL;
-    wcexF.lpszClassName = className;
-    wcexF.hIconSm = LoadIcon(wcexF.hInstance, IDI_APPLICATION);
-    RegisterClassEx(&wcexF);
- 
-
-    hChild = CreateWindowEx(
-        NULL,
-        className, childTitle,
-        WS_POPUP | WS_VISIBLE |  WS_CAPTION | WS_SYSMENU ,
-        700, 300,
-        x, y, hFather, NULL,
-        hInstanceF, NULL
-    );
-    Err(hChild,
-        _T("Create ChildWindow failed!"));
-    return hChild;
+HFONT Font();
+
+LRESULT CALLBACK WeatherProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam) {
+    switch (msg) {
+    case WM_CREATE:
+    {
+        HFONT hFont1 = Font();
+        HWND hWeaSet = CreateWindow(
+            L"BUTTON", L"基础选项",
+            WS_VISIBLE | WS_CHILD | BS_GROUPBOX,
+            20, 20, 330, 100,
+            hWnd1, NULL,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+        HWND hWeaSet_1 = CreateWindow(
+            L"BUTTON", L"晴天",
+            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | WS_GROUP,
+            40, 55, 80, 40,
+            hWnd1, (HMENU)ID_FC_Wea_SET_1,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+        HWND hWeaSet_2 = CreateWindow(
+            L"BUTTON", L"雨天",
+            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
+            140, 55, 80, 40,
+            hWnd1, (HMENU)ID_FC_Wea_SET_2,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+        HWND hWeaSet_3 = CreateWindow(
+            L"BUTTON", L"雷暴",
+            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
+            240, 55, 80, 40,
+            hWnd1, (HMENU)ID_FC_Wea_SET_3,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+
+
+        HWND hLabel_Wea_1 = CreateWindow(
+            L"STATIC", L"高级选项",
+            WS_VISIBLE | WS_CHILD,
+            30, 150, 80, 30,
+            hWnd1, NULL,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+
+        HWND hWeaAdv = CreateWindow(
+            L"BUTTON", L"天气更替",
+            WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
+            30, 190, 110, 40,
+            hWnd1, (HMENU)ID_FC_Wea_ADV,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+
+
+        HWND hWeaOK = CreateWindow(
+            L"BUTTON", L"提交",
+            WS_VISIBLE | WS_CHILD,
+            250, 250, 110, 40,
+            hWnd1, (HMENU)ID_FC_Wea_OK,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+
+        SendMessage(hWeaSet_1, BM_SETCHECK, BST_CHECKED, 0);
+        SendMessage(hWeaAdv, BM_SETCHECK, BST_CHECKED, 0);
+    }
+    break;
+
+    case WM_COMMAND:
+    {
+        WORD wmId = LOWORD(wParam);
+        switch (wmId)
+        {
+        case ID_FC_Wea_OK:
+            if (IsDlgButtonChecked(hWnd1, ID_FC_Wea_ADV) == BST_CHECKED)
+                SendCommand(C("gamerule doWeatherCycle true"));
+            else SendCommand(C("gamerule doWeatherCycle false"));
+
+            if (IsDlgButtonChecked(hWnd1, ID_FC_Wea_SET_1) == BST_CHECKED)
+                SendCommand(C("weather clear"));
+            else if (IsDlgButtonChecked(hWnd1, ID_FC_Wea_SET_2) == BST_CHECKED)
+                SendCommand(C("weather rain"));
+            else SendCommand(C("weather thunder"));
+
+            DestroyWindow(hWnd1);
+
+            break;
+
+        default:
+            break;
+        }
+        break;
+    }
+
+
+    case WM_CLOSE:
+        DestroyWindow(hWnd1);
+        break;
+    case WM_DESTROY:
+        hWeather = NULL;
+        break;
+    default:
+        return DefWindowProc(hWnd1, msg, wParam, lParam);
+    }
+    return 0;
 }
 
-HWND CreateLogWindow(LPCWCHAR childTitle, int x, int y, WNDPROC procFunc, LPCWCHAR className, HINSTANCE hInstanceF)
+LRESULT CALLBACK TimeProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam) {
+    switch (msg) {
+    case WM_CREATE:
+    {
+        HFONT hFont1 = Font();
+        HWND hWeaSet = CreateWindow(
+            L"BUTTON", L"快速设定",
+            WS_VISIBLE | WS_CHILD | BS_GROUPBOX,
+            20, 20, 330, 150,
+            hWnd1, NULL,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+        HWND hTimeSet_1 = CreateWindow(
+            L"BUTTON", L"日出",
+            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | WS_GROUP,
+            40, 55, 80, 40,
+            hWnd1, (HMENU)ID_FC_Time_SET_1,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+        HWND hTimeSet_2 = CreateWindow(
+            L"BUTTON", L"白日",
+            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
+            140, 55, 80, 40,
+            hWnd1, (HMENU)ID_FC_Time_SET_2,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+        HWND hTimeSet_3 = CreateWindow(
+            L"BUTTON", L"正午",
+            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
+            240, 55, 80, 40,
+            hWnd1, (HMENU)ID_FC_Time_SET_3,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+        HWND hTimeSet_4 = CreateWindow(
+            L"BUTTON", L"日落",
+            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
+            40, 115, 80, 40,
+            hWnd1, (HMENU)ID_FC_Time_SET_4,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+        HWND hTimeSet_5 = CreateWindow(
+            L"BUTTON", L"夜晚",
+            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
+            140, 115, 80, 40,
+            hWnd1, (HMENU)ID_FC_Time_SET_5,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+        HWND hTimeSet_6 = CreateWindow(
+            L"BUTTON", L"午夜",
+            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
+            240, 115, 80, 40,
+            hWnd1, (HMENU)ID_FC_Time_SET_6,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+
+
+        HWND hLabel_Wea_1 = CreateWindow(
+            L"STATIC", L"高级选项",
+            WS_VISIBLE | WS_CHILD,
+            30, 210, 80, 30,
+            hWnd1, NULL,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+
+        HWND hTimeAdv = CreateWindow(
+            L"BUTTON", L"时间更替",
+            WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
+            30, 250, 110, 40,
+            hWnd1, (HMENU)ID_FC_Time_ADV,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+
+
+        HWND hWeaOK = CreateWindow(
+            L"BUTTON", L"提交",
+            WS_VISIBLE | WS_CHILD,
+            250, 300, 110, 40,
+            hWnd1, (HMENU)ID_FC_Time_OK,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+
+        SendMessage(hTimeSet_3, BM_SETCHECK, BST_CHECKED, 0);
+        SendMessage(hTimeAdv, BM_SETCHECK, BST_CHECKED, 0);
+    }
+    break;
+
+    case WM_COMMAND:
+    {
+        WORD wmId = LOWORD(wParam);
+        switch (wmId)
+        {
+        case ID_FC_Time_OK:
+            if (IsDlgButtonChecked(hWnd1, ID_FC_Time_ADV) == BST_CHECKED)
+                SendCommand(C("gamerule doDaylightCycle true"));
+            else SendCommand(C("gamerule doDaylightCycle false"));
+
+            if (IsDlgButtonChecked(hWnd1, ID_FC_Wea_SET_1) == BST_CHECKED)
+                SendCommand(C("time set sunrise"));
+            else if (IsDlgButtonChecked(hWnd1, ID_FC_Time_SET_2) == BST_CHECKED)
+                SendCommand(C("time set day"));
+            else if (IsDlgButtonChecked(hWnd1, ID_FC_Time_SET_3) == BST_CHECKED)
+                SendCommand(C("time set noon"));
+            else if (IsDlgButtonChecked(hWnd1, ID_FC_Time_SET_4) == BST_CHECKED)
+                SendCommand(C("time set sunset"));
+            else if (IsDlgButtonChecked(hWnd1, ID_FC_Time_SET_5) == BST_CHECKED)
+                SendCommand(C("time set night"));
+            else SendCommand(C("time set midnight"));
+
+            DestroyWindow(hWnd1);
+
+            break;
+
+        default:
+            break;
+        }
+        break;
+    }
+
+
+    case WM_CLOSE:
+        DestroyWindow(hWnd1);
+        break;
+    case WM_DESTROY:
+        hTime = NULL;
+        break;
+    default:
+        return DefWindowProc(hWnd1, msg, wParam, lParam);
+    }
+    return 0;
+    return 0;
+}
+
+LRESULT CALLBACK LogProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-    HWND hChild = NULL;
-    static WNDCLASSEX wcexF;
-    wcexF.cbSize = sizeof(WNDCLASSEX);
-    wcexF.style = CS_HREDRAW | CS_VREDRAW | CS_NOCLOSE;
-    wcexF.lpfnWndProc = procFunc;
-    wcexF.cbClsExtra = 0;
-    wcexF.cbWndExtra = 0;
-    wcexF.hInstance = hInstanceF;
-    wcexF.hIcon = LoadIcon(wcexF.hInstance, IDI_APPLICATION);
-    wcexF.hCursor = LoadCursor(NULL, IDC_ARROW);
-    wcexF.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
-    wcexF.lpszMenuName = NULL;
-    wcexF.lpszClassName = className;
-    wcexF.hIconSm = LoadIcon(wcexF.hInstance, IDI_APPLICATION);
-    RegisterClassEx(&wcexF);
-
-
-    hChild = CreateWindowEx(
-        NULL,
-        className, childTitle,
-        WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
-        1000, 400,
-        x, y, NULL , NULL,
-        hInstanceF, NULL
-    );
-    Err(hChild,
-        _T("Create ChildWindow failed!"));
-    return hChild;
-}
+    switch (msg) {
+    case WM_CREATE:
+    {
+        SetTimer(hWnd1, 1, 100, NULL);
+        HFONT hFont1 = Font();
+        HWND hLog = CreateWindow(
+            L"EDIT", L"Null",
+            WS_VISIBLE | WS_CHILD | WS_BORDER | WS_VSCROLL | ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL,
+            30, 30, 910, 510,
+            hWnd1, (HMENU)ID_LOG,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+        HWND hLogClear = CreateWindow(
+            L"BUTTON", L"清除日志",
+            WS_VISIBLE | WS_CHILD,
+            790, 570, 110, 40,
+            hWnd1, (HMENU)ID_LOG_CLEAR,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+        break;
+    }
+    case WM_COMMAND:
+    {
+        WORD wmId = LOWORD(wParam);
+        switch (wmId)
+        {
+        case ID_LOG_CLEAR:
+            if (MessageBox(hWnd,
+                L"是否要清除所有日志?", TITLE,
+                MB_OKCANCEL | MB_APPLMODAL | MB_ICONWARNING)
+                == 1)
+            {
+                ClearLog();
+                SetWindowText(GetDlgItem(hWnd1, ID_LOG), _T("Null"));
+                break;
+            }
+        }
+    }
+    case WM_TIMER:
+        Log(GetDlgItem(hLog, ID_LOG));
+        break;
+    case WM_CLOSE:
+        break;
+    case WM_DESTROY:
+        KillTimer(hWnd1, 1);
+        hLog = NULL;
+        break;
+    default:
+        return DefWindowProc(hWnd1, msg, wParam, lParam);
+    }
+    return 0;
+}
+
+LRESULT CALLBACK PlayerProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam) {
+    switch (msg) {
+    case WM_CREATE:
+    {
+        HFONT hFont1 = Font();
+        HWND hWeaSet = CreateWindow(
+            L"BUTTON", L"快速设定",
+            WS_VISIBLE | WS_CHILD | BS_GROUPBOX,
+            20, 20, 330, 150,
+            hWnd1, NULL,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+
+
+        HWND hWeaOK = CreateWindow(
+            L"BUTTON", L"提交",
+            WS_VISIBLE | WS_CHILD,
+            250, 300, 110, 40,
+            hWnd1, (HMENU)ID_FC_Player_OK,
+            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
+        );
+
+    }
+    break;
+
+    case WM_COMMAND:
+    {
+        WORD wmId = LOWORD(wParam);
+        switch (wmId)
+        {
+        case ID_FC_Player_OK:
+
+            DestroyWindow(hWnd1);
+            break;
+
+        default:
+            break;
+        }
+        break;
+    }
+
+
+    case WM_CLOSE:
+        DestroyWindow(hWnd1);
+        break;
+    case WM_DESTROY:
+        hPlayer = NULL;
+        break;
+    default:
+        return DefWindowProc(hWnd1, msg, wParam, lParam);
+    }
+    return 0;
+    return 0;
+}

+ 67 - 0
Ui for BDS/childProcSet.cpp

@@ -0,0 +1,67 @@
+#include "Win32.h"
+#include "ID.h"
+#include "Function.h"
+
+HWND CreateChildWindow(HWND hFather, LPCWCHAR childTitle ,int x, int y, WNDPROC procFunc, LPCWCHAR className, HINSTANCE hInstanceF)
+{
+    HWND hChild = NULL;
+    static WNDCLASSEX wcexF;
+    wcexF.cbSize = sizeof(WNDCLASSEX);
+    wcexF.style = CS_HREDRAW | CS_VREDRAW;
+    wcexF.lpfnWndProc = procFunc;
+    wcexF.cbClsExtra = 0;
+    wcexF.cbWndExtra = 0;
+    wcexF.hInstance = hInstanceF;
+    wcexF.hIcon = LoadIcon(wcexF.hInstance, IDI_APPLICATION);
+    wcexF.hCursor = LoadCursor(NULL, IDC_ARROW);
+    wcexF.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
+    wcexF.lpszMenuName = NULL;
+    wcexF.lpszClassName = className;
+    wcexF.hIconSm = LoadIcon(wcexF.hInstance, IDI_APPLICATION);
+    RegisterClassEx(&wcexF);
+ 
+
+    hChild = CreateWindowEx(
+        NULL,
+        className, childTitle,
+        WS_POPUP | WS_VISIBLE |  WS_CAPTION | WS_SYSMENU ,
+        700, 300,
+        x, y, hFather, NULL,
+        hInstanceF, NULL
+    );
+    Err(hChild,
+        _T("Create ChildWindow failed!"));
+    return hChild;
+}
+
+HWND CreateLogWindow(LPCWCHAR childTitle, int x, int y, WNDPROC procFunc, LPCWCHAR className, HINSTANCE hInstanceF)
+{
+    HWND hChild = NULL;
+    static WNDCLASSEX wcexF;
+    wcexF.cbSize = sizeof(WNDCLASSEX);
+    wcexF.style = CS_HREDRAW | CS_VREDRAW | CS_NOCLOSE;
+    wcexF.lpfnWndProc = procFunc;
+    wcexF.cbClsExtra = 0;
+    wcexF.cbWndExtra = 0;
+    wcexF.hInstance = hInstanceF;
+    wcexF.hIcon = LoadIcon(wcexF.hInstance, IDI_APPLICATION);
+    wcexF.hCursor = LoadCursor(NULL, IDC_ARROW);
+    wcexF.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
+    wcexF.lpszMenuName = NULL;
+    wcexF.lpszClassName = className;
+    wcexF.hIconSm = LoadIcon(wcexF.hInstance, IDI_APPLICATION);
+    RegisterClassEx(&wcexF);
+
+
+    hChild = CreateWindowEx(
+        NULL,
+        className, childTitle,
+        WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
+        1000, 400,
+        x, y, NULL , NULL,
+        hInstanceF, NULL
+    );
+    Err(hChild,
+        _T("Create ChildWindow failed!"));
+    return hChild;
+}

+ 1 - 0
Ui for BDS/cmdSend.cpp

@@ -1,6 +1,7 @@
 #include "Win32.h"
 #include "ID.h"
 #include "Function.h"
+#include "SharedValue.h"
 
 //Send
 bool SendCommand(LPCSTR command)

+ 0 - 2
Ui for BDS/errCheck.cpp

@@ -1,6 +1,4 @@
 #include "Win32.h"
-#include "ID.h"
-
 
 static LPWSTR GetError()
 {

+ 1 - 0
Ui for BDS/log.cpp

@@ -1,6 +1,7 @@
 #include "Win32.h"
 #include "ID.h"
 #include "Function.h"
+#include "SharedValue.h"
 
 static bool statu = TRUE;
 

+ 2 - 1
Ui for BDS/o&c.cpp

@@ -1,6 +1,7 @@
 #include "Win32.h"
 #include "ID.h"
 #include "Function.h"
+#include "SharedValue.h"
 
 
 static void AutoClose(DWORD time, LPCWSTR title)
@@ -34,7 +35,7 @@ static void CloseHandleS()
     CloseHandle(BDSw_log);
 }
 
-InitH(BDSr_key); InitH(UIw_key); InitH(BDSw_log); InitH(UIr_log);
+InitHA(BDSr_key); InitHA(UIw_key); InitHA(BDSw_log); InitHA(UIr_log);
 void StartBDS()
 {
     SECURITY_ATTRIBUTES sa = { sizeof(sa),NULL , TRUE };