VoiletWindowsActionTool/main.c

485 lines
17 KiB
C
Raw Normal View History

2024-10-03 09:12:08 +00:00
#include <windows.h>
#include <stdio.h>
2024-12-30 14:40:46 +00:00
#define START_ACTION_BTN_ID 1001 // 定义激活按钮 ID
2024-10-03 09:12:08 +00:00
2024-12-30 14:40:46 +00:00
#define ENGLISH 0 // 英文
#define CHINESE 1 // 中文
2024-10-03 09:12:08 +00:00
2024-12-30 14:40:46 +00:00
#define INFO_LEFT_MARGIN 20 // 组件左侧边距
// 组件
2024-10-03 09:12:08 +00:00
WNDCLASSEX wc;
HWND hwnd;
MSG msg;
HWND SystemLang;
HWND SystemVersion;
HWND ActionServerText;
HWND ActionServerAddr;
HWND ActionBtn;
2024-12-30 14:40:46 +00:00
static HFONT hFont; // 用于存储字体对象的句柄
2024-10-03 09:12:08 +00:00
2024-12-30 14:40:46 +00:00
// 当前语言选项
int CurSystemLang = CHINESE;
2024-10-03 09:12:08 +00:00
2024-12-30 14:40:46 +00:00
// 当前系统版本选项
2024-10-03 09:12:08 +00:00
int CurSystemVersion = 0;
2024-12-30 14:40:46 +00:00
// 存放激活信息和对应显示语言信息的结构体
2024-10-03 09:12:08 +00:00
typedef struct
{
char *Key;
char *English;
char *Chinese;
}SYSTEM_VERSION,*SYSTEM_VERSION_PTR;
2024-12-30 14:40:46 +00:00
//存放激活信息的结构体
2024-10-03 09:12:08 +00:00
typedef struct
{
char *Key;
char *ActionServer;
}ACTION_INFO,*ACTION_INFO_PTR;
2024-12-30 14:40:46 +00:00
// 多语言列表
2024-10-03 09:12:08 +00:00
const char *SystemLangList[] = {
"English",
2024-12-30 14:40:46 +00:00
"简体中文",
2024-10-03 09:12:08 +00:00
NULL,
};
2024-12-30 14:40:46 +00:00
// 激活服务器文本
2024-10-03 09:12:08 +00:00
const char *ActionServerStr[] = {
"Action Server : ",
2024-12-30 14:40:46 +00:00
"激活服务器 : ",
2024-10-03 09:12:08 +00:00
};
2024-12-30 14:40:46 +00:00
// 激活按钮文本
2024-10-03 09:12:08 +00:00
const char *ActionBtnStr[] = {
"Start Action",
2024-12-30 14:40:46 +00:00
"开始激活",
2024-10-03 09:12:08 +00:00
};
ACTION_INFO ActionInfo;
2024-12-30 14:40:46 +00:00
//初始化版本信息
2024-10-03 09:12:08 +00:00
const SYSTEM_VERSION SystemVersionList[] = {
2024-12-30 14:40:46 +00:00
{.Key = "FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4", .English = "Windows 7 Pro", .Chinese = "Windows 7 专业版"},
{.Key = "MRPKT-YTG23-K7D7T-X2JMM-QY7MG", .English = "Windows 7 Pro N", .Chinese = "Windows 7 专业版 N"},
{.Key = "W82YF-2Q76Y-63HXB-FGJG9-GF7QX", .English = "Windows 7 Pro E", .Chinese = "Windows 7 专业版 E"},
{.Key = "33PXH-7Y6KF-2VJC9-XBBR8-HVTHH", .English = "Windows 7 Enterprise", .Chinese = "Windows 7 企业版"},
{.Key = "YDRBP-3D83W-TY26F-D46B2-XCKRJ", .English = "Windows 7 Enterprise N", .Chinese = "Windows 7 企业版 N"},
{.Key = "C29WB-22CC8-VJ326-GHFJW-H9DH4", .English = "Windows 7 Enterprise E", .Chinese = "Windows 7 企业版 E"},
{.Key = "NG4HW-VH26C-733KW-K6F98-J8CK4", .English = "Windows 8 Pro", .Chinese = "Windows 8 专业版"},
{.Key = "XCVCF-2NXM9-723PB-MHCB7-2RYQQ", .English = "Windows 8 Pro N", .Chinese = "Windows 8 专业版 N"},
{.Key = "32JNW-9KQ84-P47T8-D8GGY-CWCK7", .English = "Windows 8 Enterprise", .Chinese = "Windows 8 企业版"},
{.Key = "JMNMF-RHW7P-DMY6X-RF3DR-X2BQT", .English = "Windows 8 Enterprise N", .Chinese = "Windows 8 企业版 N"},
{.Key = "GCRJD-8NW9H-F2CDX-CCM8D-9D6T9", .English = "Windows 8.1 Pro", .Chinese = "Windows 8.1 专业版"},
{.Key = "HMCNV-VVBFX-7HMBH-CTY9B-B4FXY", .English = "Windows 8.1 Pro N", .Chinese = "Windows 8.1 专业版 N"},
{.Key = "MHF9N-XY6XB-WVXMC-BTDCT-MKKG7", .English = "Windows 8.1 Enterprise", .Chinese = "Windows 8.1 企业版"},
{.Key = "TT4HM-HN7YT-62K67-RGRQJ-JFFXW", .English = "Windows 8.1 Enterprise N", .Chinese = "Windows 8.1 企业版 N"},
{.Key = "TX9XD-98N7V-6WMQ6-BX7FG-H8Q99", .English = "Windows 10/11 Home", .Chinese = "Windows 10/11 家庭版"},
{.Key = "PVMJN-6DFY6-9CCP6-7BKTT-D3WVR", .English = "Windows 10/11 Home zh-cn", .Chinese = "Windows 10/11 家庭中文版"},
{.Key = "W269N-WFGWX-YVC9B-4J6C9-T83GX", .English = "Windows 10/11 Pro", .Chinese = "Windows 10/11 专业版"},
{.Key = "MH37W-N47XK-V7XM9-C7227-GCQG9", .English = "Windows 10/11 Pro N", .Chinese = "Windows 10/11 专业版 N"},
{.Key = "NRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J", .English = "Windows 10/11 Pro Workstation", .Chinese = "Windows 10/11 专业工作站版"},
{.Key = "9FNHH-K3HBT-3W4TD-6383H-6XYWF", .English = "Windows 10/11 Pro Workstation N", .Chinese = "Windows 10/11 专业工作站版 N"},
{.Key = "6TP4R-GNPTD-KYYHQ-7B7DP-J447Y", .English = "Windows 10/11 Pro Edu", .Chinese = "Windows 10/11 专业教育版"},
{.Key = "YVWGF-BXNMC-HTQYQ-CPQ99-66QFC", .English = "Windows 10/11 Pro Edu N", .Chinese = "Windows 10/11 专业教育版 N"},
{.Key = "NW6C2-QMPVW-D7KKK-3GKT6-VCFB2", .English = "Windows 10/11 Edu", .Chinese = "Windows 10/11 教育版"},
{.Key = "2WH4N-8QGBV-H22JP-CT43Q-MDWWJ", .English = "Windows 10/11 Edu N", .Chinese = "Windows 10/11 教育版 N"},
{.Key = "NPPR9-FWDCX-D2C8J-H872K-2YT43", .English = "Windows 10/11 Enterprise", .Chinese = "Windows 10/11 企业版"},
{.Key = "DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4", .English = "Windows 10/11 Enterprise N", .Chinese = "Windows 10/11 企业版 N"},
{.Key = "YYVX9-NTFWV-6MDM3-9PT4T-4M68B", .English = "Windows 10/11 Enterprise G", .Chinese = "Windows 10/11 企业版 G"},
{.Key = "44RPN-FTY23-9VTTB-MP9BX-T84FV", .English = "Windows 10/11 Enterprise G N", .Chinese = "Windows 10/11 企业版 G N"},
{.Key = "M7XTQ-FN8P6-TTKYV-9D4CC-J462D", .English = "Windows 10/11 LTSC", .Chinese = "Windows 10/11 长期支持版"},
{.Key = "92NFX-8DJQP-P6BBQ-THF9C-7CG2H", .English = "Windows 10/11 LTSC N", .Chinese = "Windows 10/11 长期支持版 N"},
{.Key = "KBN8V-HFGQ4-MGXVD-347P6-PDQGT", .English = "Windows 10/11 IoT LTSC", .Chinese = "Windows 10/11 物联网 长期支持版"},
{.Key = "DCPHK-NFMTC-H88MJ-PFHPY-QJ4BJ", .English = "Windows 10/11 LTSB 2016", .Chinese = "Windows 10/11 长期支持版 2016"},
{.Key = "QFFDN-GRT3P-VKWWX-X7T3R-8B639", .English = "Windows 10/11 LTSB 2016 N", .Chinese = "Windows 10/11 长期支持版 2016 N"},
{.Key = "VDYBN-27WPP-V4HQT-9VMD4-VMK7H", .English = "Windows Server 2022 Standard", .Chinese = "Windows Server 2022 标准版"},
{.Key = "WX4NM-KYWYW-QJJR4-XV3QB-6VM33", .English = "Windows Server 2022 Datacenter", .Chinese = "Windows Server 2022 数据中心版"},
{.Key = "NTBV8-9K7Q8-V27C6-M2BTV-KHMXV", .English = "Windows Server 2022 Datacenter Azure", .Chinese = "Windows Server 2022 数据中心版 Azure"},
{.Key = "N69G4-B89J2-4G8F4-WWYCC-J464C", .English = "Windows Server 2019 Standard", .Chinese = "Windows Server 2019 标准版"},
{.Key = "WMDGN-G9PQG-XVVXX-R3X43-63DFG", .English = "Windows Server 2019 Datacenter", .Chinese = "Windows Server 2019 数据中心版"},
{.Key = "WVDHN-86M7X-466P6-VHXV7-YY726", .English = "Windows Server 2019 Datacenter Azure", .Chinese = "Windows Server 2019 数据中心版 Azure"},
{.Key = "WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY", .English = "Windows Server 2016 Standard", .Chinese = "Windows Server 2016 标准版"},
{.Key = "CB7KF-BWN84-R7R2Y-793K2-8XDDG", .English = "Windows Server 2016 Datacenter", .Chinese = "Windows Server 2016 数据中心版"},
{.Key = "JCKRF-N37P4-C2D82-9YXRT-4M63B", .English = "Windows Server 2016 Datacenter Azure", .Chinese = "Windows Server 2016 数据中心版 Azure"},
{.Key = "N2KJX-J94YW-TQVFB-DG9YT-724CC", .English = "Windows Server Standard Half Year", .Chinese = "Windows Server 标准版 半年"},
{.Key = "6NMRW-2C8FM-D24W7-TQWMY-CWH2D", .English = "Windows Server Datacenter Half Year", .Chinese = "Windows Server 数据中心版 半年"},
2024-10-03 09:12:08 +00:00
{.Key = NULL, .English = NULL, .Chinese = NULL},
};
int GetSystemLangLen(void);
int GetSystemListLen(void);
void TranslateApp(void);
void RunSlmgrCommand(const char* command);
void ExecActionCommand(void);
2024-12-30 14:40:46 +00:00
/* 处理窗口消息的回调函数 */
2024-10-03 09:12:08 +00:00
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
char Buffer[256] = {0x00};
2024-12-30 14:40:46 +00:00
switch(Message) {
case WM_CREATE:
{
// 创建微软雅黑字体
hFont = CreateFont(
20, // 字体高度
0, // 字体宽度
0, // 字符旋转角度
0, // 字符倾斜角度
FW_NORMAL, // 字体粗细
FALSE, // 是否斜体
FALSE, // 是否下划线
FALSE, // 是否删除线
DEFAULT_CHARSET, // 字符集
OUT_TT_PRECIS, // 输出精度
CLIP_DEFAULT_PRECIS, // 剪辑精度
DEFAULT_QUALITY, // 输出质量
DEFAULT_PITCH | FF_SWISS, // 字体类型
L"微软雅黑" // 字体名称
);
}
break;
case WM_DESTROY: {
// 释放字体资源
if (hFont) {
DeleteObject(hFont);
hFont = NULL;
}
PostQuitMessage(0);
break;
}
case WM_COMMAND:
// 激活按钮的点击事件
if (LOWORD(wParam) == START_ACTION_BTN_ID) { // 判断按钮是否被点击
// 激活信息解析激活密钥
2024-10-03 09:12:08 +00:00
ActionInfo.Key = SystemVersionList[CurSystemVersion].Key;
2024-12-30 14:40:46 +00:00
// 激活信息解析激活服务器地址
2024-10-03 09:12:08 +00:00
GetWindowText(ActionServerAddr,Buffer,sizeof(Buffer));
ActionInfo.ActionServer = Buffer;
ExecActionCommand();
2024-12-30 14:40:46 +00:00
}
// 两个下拉列表的点击事件
if (HIWORD(wParam) == CBN_SELCHANGE) {
// 判断哪个 ComboBox 被选中
HWND hComboBox = (HWND)lParam;
if (hComboBox == SystemLang)
2024-10-03 09:12:08 +00:00
{
2024-12-30 14:40:46 +00:00
// 翻译软件
2024-10-03 09:12:08 +00:00
CurSystemLang = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
TranslateApp();
2024-12-30 14:40:46 +00:00
} else if (hComboBox == SystemVersion)
2024-10-03 09:12:08 +00:00
{
2024-12-30 14:40:46 +00:00
// 选中系统版本
2024-10-03 09:12:08 +00:00
CurSystemVersion = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
2024-12-30 14:40:46 +00:00
// 激活信息解析激活密钥
2024-10-03 09:12:08 +00:00
ActionInfo.Key = SystemVersionList[CurSystemVersion].Key;
2024-12-30 14:40:46 +00:00
}
}
break;
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
return 0;
2024-10-03 09:12:08 +00:00
}
2024-12-30 14:40:46 +00:00
/* Win32 程序的入口点 */
2024-10-03 09:12:08 +00:00
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
2024-12-30 14:40:46 +00:00
memset(&wc,0,sizeof(wc));
wc.cbSize = sizeof(WNDCLASSEX);
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszClassName = "WindowClass";
2024-10-03 09:12:08 +00:00
wc.hIcon = LoadIcon(hInstance, "A");
wc.hIconSm = LoadIcon(hInstance, "A");
2024-12-30 14:40:46 +00:00
if(!RegisterClassEx(&wc)) {
MessageBox(NULL, "Window Registration Failed!","Error!",MB_ICONEXCLAMATION|MB_OK);
return 0;
}
hwnd = CreateWindowEx(
WS_EX_CLIENTEDGE,
"WindowClass",
"紫罗兰Windows激活工具v1.1.1",
WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT, 480, 260,
NULL, NULL, hInstance, NULL);
if(hwnd == NULL) {
MessageBox(NULL, "Window Creation Failed!","Error!",MB_ICONEXCLAMATION|MB_OK);
return 0;
}
// 存放多语言下拉列表
2024-10-03 09:12:08 +00:00
SystemLang = CreateWindowEx(
2024-12-30 14:40:46 +00:00
0, // 窗口扩展样式
"COMBOBOX", // ComboBox 类名,注意这里是 "COMBOBOX"
NULL, // 默认标题
CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL, // ComboBox 样式
INFO_LEFT_MARGIN, 10, // x, y 位置
180, 200, // 宽度和高度
hwnd, // 父窗口句柄
0, // 控件ID可以用来识别控件
hInstance, // 实例句柄
NULL // 无附加参数
);
// 设置下拉列表的字体
SendMessage(SystemLang, WM_SETFONT, (WPARAM)hFont, TRUE);
// 将语言列表添加到下拉列表中
2024-10-03 09:12:08 +00:00
for(int i = 0;i < GetSystemLangLen();i++){
2024-12-30 14:40:46 +00:00
// 向 ComboBox 添加选项
SendMessage(SystemLang, CB_ADDSTRING, 0, (LPARAM)SystemLangList[i]);
2024-10-03 09:12:08 +00:00
}
2024-12-30 14:40:46 +00:00
// 默认选中第一个选项
SendMessage(SystemLang, CB_SETCURSEL, (WPARAM)CHINESE, 0);
// 存放系统列表
2024-10-03 09:12:08 +00:00
SystemVersion = CreateWindowEx(
2024-12-30 14:40:46 +00:00
0, // 窗口扩展样式
"COMBOBOX", // ComboBox 类名,注意这里是 "COMBOBOX"
NULL, // 默认标题
CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL, // ComboBox 样式
INFO_LEFT_MARGIN, 50, // x, y 位置
420, 500, // 宽度和高度
hwnd, // 父窗口句柄
1, // 控件ID可以用来识别控件
hInstance, // 实例句柄
NULL // 无附加参数
);
// 设置下拉列表的字体
SendMessage(SystemVersion, WM_SETFONT, (WPARAM)hFont, TRUE);
// 将系统版本添加到下拉列表中
2024-10-03 09:12:08 +00:00
for(int i = 0;i < GetSystemListLen();i++){
2024-12-30 14:40:46 +00:00
// 向 ComboBox 添加选项
SendMessage(SystemVersion, CB_ADDSTRING, 0, (LPARAM)SystemVersionList[i].English);
2024-10-03 09:12:08 +00:00
}
2024-12-30 14:40:46 +00:00
// 默认选中第一个选项
2024-10-03 09:12:08 +00:00
SendMessage(SystemVersion, CB_SETCURSEL, (WPARAM)0, 0);
2024-12-30 14:40:46 +00:00
// 激活服务器标签
2024-10-03 09:12:08 +00:00
ActionServerText = CreateWindowEx(
2024-12-30 14:40:46 +00:00
0, // 窗口扩展样式
"STATIC", // 标签类名
ActionServerStr[CurSystemLang], // 标签文本
WS_VISIBLE | WS_CHILD, // 标签样式
INFO_LEFT_MARGIN, 90, // x, y 位置
180, 20, // 宽度和高度
hwnd, // 父窗口句柄
NULL, // 控件ID
hInstance, // 实例句柄
NULL // 附加参数
);
// 设置下拉列表的字体
SendMessage(ActionServerText, WM_SETFONT, (WPARAM)hFont, TRUE);
// 创建一个输入框(编辑控件)
2024-10-03 09:12:08 +00:00
ActionServerAddr = CreateWindowEx(
2024-12-30 14:40:46 +00:00
0, // 窗口扩展样式
"EDIT", // 控件类名
"kms.03k.org", // 默认文本
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT, // 样式
INFO_LEFT_MARGIN, 120, // x, y 位置
180, 24, // 宽度和高度
hwnd, // 父窗口句柄
NULL, // 控件ID
hInstance, // 实例句柄
NULL // 附加参数
);
// 设置下拉列表的字体
SendMessage(ActionServerAddr, WM_SETFONT, (WPARAM)hFont, TRUE);
// 激活按钮
2024-10-03 09:12:08 +00:00
ActionBtn = CreateWindowEx(
2024-12-30 14:40:46 +00:00
0, // 窗口扩展样式
"BUTTON", // 按钮类名
ActionBtnStr[CurSystemLang], // 按钮文本
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, // 按钮样式
INFO_LEFT_MARGIN, 160, // x, y 位置
150, 30, // 宽度和高度
hwnd, // 父窗口句柄
START_ACTION_BTN_ID, // 控件ID
hInstance, // 实例句柄
NULL // 附加参数
);
// 设置下拉列表的字体
SendMessage(ActionBtn, WM_SETFONT, (WPARAM)hFont, TRUE);
2024-10-03 09:12:08 +00:00
2024-12-30 14:40:46 +00:00
// 消息循环
while(GetMessage(&msg, NULL, 0, 0) > 0) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
2024-10-03 09:12:08 +00:00
}
2024-12-30 14:40:46 +00:00
// 获取多语言选项列表长度
2024-10-03 09:12:08 +00:00
int GetSystemLangLen(void)
{
int SystemLangNum = 0x00;
while(1){
if(SystemLangList[SystemLangNum] == NULL)
{
break;
}
else
{
SystemLangNum++;
}
}
return (SystemLangNum);
}
2024-12-30 14:40:46 +00:00
// 获取系统版本列表的长度
2024-10-03 09:12:08 +00:00
int GetSystemListLen(void)
{
int SystemListNum = 0x00;
while(1){
if(SystemVersionList[SystemListNum].Key == NULL)
{
break;
}
else
{
SystemListNum++;
}
}
return (SystemListNum);
}
2024-12-30 14:40:46 +00:00
// 执行slmgr命令
2024-10-03 09:12:08 +00:00
void RunSlmgrCommand(const char* command)
{
2024-12-30 14:40:46 +00:00
// 创建完整的命令字符串
char fullCommand[256];
snprintf(fullCommand, sizeof(fullCommand), "cmd.exe /c %s", command);
// 执行命令
ShellExecute(NULL, "runas", "cmd.exe", fullCommand, NULL, SW_SHOWNORMAL);
2024-10-03 09:12:08 +00:00
}
2024-12-30 14:40:46 +00:00
// 安装密钥
2024-10-03 09:12:08 +00:00
void InstallKey(void)
{
char BaseCmd[256] = {"slmgr /ipk "};
2024-12-30 14:40:46 +00:00
2024-10-03 09:12:08 +00:00
snprintf(BaseCmd + strlen(BaseCmd), sizeof(BaseCmd) - strlen(BaseCmd), "%s", ActionInfo.Key);
RunSlmgrCommand(BaseCmd);
2024-12-30 14:40:46 +00:00
//MessageBox(hwnd, BaseCmd, "提示", MB_OK | MB_ICONINFORMATION);
2024-10-03 09:12:08 +00:00
}
2024-12-30 14:40:46 +00:00
// 设置激活服务器
2024-10-03 09:12:08 +00:00
void SetActionServer(void)
{
char BaseCmd[256] = {"slmgr /skms "};
2024-12-30 14:40:46 +00:00
2024-10-03 09:12:08 +00:00
snprintf(BaseCmd + strlen(BaseCmd), sizeof(BaseCmd) - strlen(BaseCmd), "%s", ActionInfo.ActionServer);
RunSlmgrCommand(BaseCmd);
2024-12-30 14:40:46 +00:00
//MessageBox(hwnd, BaseCmd, "提示", MB_OK | MB_ICONINFORMATION);
2024-10-03 09:12:08 +00:00
}
2024-12-30 14:40:46 +00:00
// 开始激活
2024-10-03 09:12:08 +00:00
void StartAction(void)
{
char BaseCmd[256] = {"slmgr /ato "};
RunSlmgrCommand(BaseCmd);
}
2024-12-30 14:40:46 +00:00
// 开始执行激活命令
2024-10-03 09:12:08 +00:00
void ExecActionCommand(void)
{
InstallKey();
SetActionServer();
StartAction();
}
2024-12-30 14:40:46 +00:00
//翻译至英文
2024-10-03 09:12:08 +00:00
void TranslateEnglish(void)
{
2024-12-30 14:40:46 +00:00
//清空系统版本列表
2024-10-03 09:12:08 +00:00
SendMessage(SystemVersion, CB_RESETCONTENT, 0, 0);
2024-12-30 14:40:46 +00:00
//重新添加
// 将系统版本添加到下拉列表中
2024-10-03 09:12:08 +00:00
for(int i = 0;i < GetSystemListLen();i++){
2024-12-30 14:40:46 +00:00
// 向 ComboBox 添加选项
SendMessage(SystemVersion, CB_ADDSTRING, 0, (LPARAM)SystemVersionList[i].English);
2024-10-03 09:12:08 +00:00
}
2024-12-30 14:40:46 +00:00
// 修改激活服务器文本标签
2024-10-03 09:12:08 +00:00
SendMessage(ActionServerText, WM_SETTEXT, 0, (LPARAM)ActionServerStr[CurSystemLang]);
2024-12-30 14:40:46 +00:00
// 修改激活按钮的文本
2024-10-03 09:12:08 +00:00
SendMessage(ActionBtn, WM_SETTEXT, 0, (LPARAM)ActionBtnStr[CurSystemLang]);
}
2024-12-30 14:40:46 +00:00
//翻译至中文
2024-10-03 09:12:08 +00:00
void TranslateChinese(void)
{
SendMessage(SystemVersion, CB_RESETCONTENT, 0, 0);
2024-12-30 14:40:46 +00:00
//重新添加
// 将系统版本添加到下拉列表中
2024-10-03 09:12:08 +00:00
for(int i = 0;i < GetSystemListLen();i++){
2024-12-30 14:40:46 +00:00
// 向 ComboBox 添加选项
SendMessage(SystemVersion, CB_ADDSTRING, 0, (LPARAM)SystemVersionList[i].Chinese);
2024-10-03 09:12:08 +00:00
}
2024-12-30 14:40:46 +00:00
// 修改激活服务器文本标签
2024-10-03 09:12:08 +00:00
SendMessage(ActionServerText, WM_SETTEXT, 0, (LPARAM)ActionServerStr[CurSystemLang]);
2024-12-30 14:40:46 +00:00
// 修改激活按钮的文本
2024-10-03 09:12:08 +00:00
SendMessage(ActionBtn, WM_SETTEXT, 0, (LPARAM)ActionBtnStr[CurSystemLang]);
}
2024-12-30 14:40:46 +00:00
//翻译软件
2024-10-03 09:12:08 +00:00
void TranslateApp(void)
{
switch (CurSystemLang) {
2024-12-30 14:40:46 +00:00
case ENGLISH:
TranslateEnglish();
break;
case CHINESE:
TranslateChinese();
break;
default:
TranslateEnglish();
break;
2024-10-03 09:12:08 +00:00
}
2024-12-30 14:40:46 +00:00
// 默认系统版本选中第一个选项
2024-10-03 09:12:08 +00:00
SendMessage(SystemVersion, CB_SETCURSEL, (WPARAM)0, 0);
}
2024-12-30 14:40:46 +00:00