Browse Source

update 8/13 16

XKSYU2021 2 tháng trước cách đây
mục cha
commit
cc2aa1f246
2 tập tin đã thay đổi với 28 bổ sung2 xóa
  1. 1 0
      Ui for BDS/ID.h
  2. 27 2
      Ui for BDS/MAIN.cpp

+ 1 - 0
Ui for BDS/ID.h

@@ -16,5 +16,6 @@ extern HWND hWnd;
 #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_Time 30200

+ 27 - 2
Ui for BDS/MAIN.cpp

@@ -41,7 +41,7 @@ int WINAPI WinMain(
         szWindowClass, szTitle,
         WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
         CW_USEDEFAULT, CW_USEDEFAULT,
-        530, 560, NULL, NULL,
+        610, 600, NULL, NULL,
         hInstance, NULL
     );
     Err(hWnd,
@@ -77,6 +77,7 @@ int WINAPI WinMain(
         (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE), NULL
     );
 
+
     HWND hLabel_2 = CreateWindow(
         L"STATIC", L"命令输入",
         WS_VISIBLE | WS_CHILD,
@@ -98,6 +99,15 @@ int WINAPI WinMain(
         hWnd, (HMENU)ID_CMD_OK,
         (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE), NULL
     );
+    HWND hCmdClear = CreateWindow(
+        L"BUTTON", L"清空",
+        WS_VISIBLE | WS_CHILD,
+        490, 200, 70, 40,
+        hWnd, (HMENU)ID_CMD_CLEAR,
+        (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE), NULL
+    );
+
+
     HWND hLabel_3 = CreateWindow(
         L"STATIC", L"快捷命令",
         WS_VISIBLE | WS_CHILD,
@@ -156,7 +166,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
     PAINTSTRUCT ps;
     HDC hdc;
-    TCHAR greeting[] = _T("by xksyu2021\nYou must obey Minecraft EULA.");
+    TCHAR greeting[] = _T("by xksyu2021\nYou must obey / 您必须遵守 Minecraft EULA.");
 
     switch (message)
     {
@@ -188,6 +198,21 @@ 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)
+            {
+                char Command[1024] = { 0 };
+                GetWindowTextA(GetDlgItem(hWnd, ID_CMD_KEY), Command, 1024);
+                std::string temp(Command);
+                temp += "\n";
+                SendCommand(temp.c_str());
+            }
+            break;
+        }
+        case ID_CMD_CLEAR:
+            SetWindowText(GetDlgItem(hWnd, ID_CMD_KEY), _T(" "));
+            break;
         case ID_FC_Weather:
             if(!hWeather)
             {