使用微软雅黑
This commit is contained in:
parent
529d372c06
commit
be1cce2561
39
Makefile.win
39
Makefile.win
@ -1,34 +1,37 @@
|
|||||||
# Project: VoiletWindowsActionTool
|
# Project: VoiletWindowsActionTool
|
||||||
# Makefile created by Dev-C++ 6.7.5
|
# Makefile created by Red Panda C++ 3.2.2958
|
||||||
|
|
||||||
CPP = g++.exe -D__DEBUG__
|
CXX = "g++.exe"
|
||||||
CC = gcc.exe -D__DEBUG__
|
CC = "gcc.exe"
|
||||||
WINDRES = windres.exe
|
WINDRES = "windres.exe"
|
||||||
|
RM = del /q /f
|
||||||
|
CD = cd /d
|
||||||
|
LIBS = "-Wl,--stack,12582912" "-mwindows" "-static"
|
||||||
|
INCS =
|
||||||
|
CXXINCS =
|
||||||
|
CXXFLAGS = $(CXXINCS) "-g3" "-Wall" "-D_DEBUG"
|
||||||
|
CFLAGS = $(INCS) "-std=c99" "-g3" "-Wall" "-D_DEBUG"
|
||||||
|
WINDRESFLAGS =
|
||||||
RES = VoiletWindowsActionTool_private.res
|
RES = VoiletWindowsActionTool_private.res
|
||||||
OBJ = main.o $(RES)
|
OBJ = main.o $(RES)
|
||||||
LINKOBJ = main.o $(RES)
|
|
||||||
LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -g3 -mwindows -static
|
|
||||||
INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/10.3.0/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/10.3.0/include-fixed" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include"
|
|
||||||
CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include/c++/10.3.0" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include/c++/10.3.0/x86_64-w64-mingw32" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include/c++/10.3.0/backward" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/10.3.0/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/10.3.0/include-fixed" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include"
|
|
||||||
BIN = VoiletWindowsActionTool.exe
|
BIN = VoiletWindowsActionTool.exe
|
||||||
CXXFLAGS = $(CXXINCS) -Wall -Wextra -g3
|
LINKOBJ = "main.o" "VoiletWindowsActionTool_private.res"
|
||||||
ENCODINGS = -finput-charset=utf-8 -fexec-charset=gbk
|
CLEANOBJ = "main.o" "VoiletWindowsActionTool_private.res" "VoiletWindowsActionTool.exe"
|
||||||
CFLAGS = $(INCS) -Wall -Wextra -g3
|
|
||||||
RM = del /q /f
|
|
||||||
|
|
||||||
.PHONY: all all-before all-after clean clean-custom
|
.PHONY: all all-before all-after clean clean-custom
|
||||||
|
|
||||||
all: all-before $(BIN) all-after
|
all: all-before $(BIN) all-after
|
||||||
|
|
||||||
clean: clean-custom
|
clean: clean-custom
|
||||||
${RM} $(OBJ) $(BIN)
|
-$(RM) $(CLEANOBJ) >NUL 2>&1
|
||||||
|
|
||||||
$(BIN): $(OBJ)
|
VoiletWindowsActionTool.exe: $(OBJ)
|
||||||
$(CC) $(LINKOBJ) -o "$(BIN)" $(LIBS)
|
|
||||||
|
$(CC) $(LINKOBJ) -o "VoiletWindowsActionTool.exe" $(LIBS)
|
||||||
|
|
||||||
main.o: main.c
|
main.o: main.c
|
||||||
$(CC) -c main.c -o main.o $(CFLAGS)
|
$(CC) -c "main.c" -o "main.o" $(CFLAGS) -finput-charset=UTF-8 -fexec-charset=gbk
|
||||||
|
|
||||||
VoiletWindowsActionTool_private.res: VoiletWindowsActionTool_private.rc resource.rc
|
VoiletWindowsActionTool_private.res: VoiletWindowsActionTool_private.rc resource.rc
|
||||||
$(WINDRES) -i VoiletWindowsActionTool_private.rc --input-format=rc -o VoiletWindowsActionTool_private.res -O coff
|
$(WINDRES) -i "VoiletWindowsActionTool_private.rc" --input-format=rc -o "VoiletWindowsActionTool_private.res" -O coff $(WINDRESFLAGS)
|
||||||
|
|
||||||
|
5
VoiletWindowsActionTool.bookmarks
Normal file
5
VoiletWindowsActionTool.bookmarks
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"bookmarks": [
|
||||||
|
],
|
||||||
|
"timestamp": "1735569601958"
|
||||||
|
}
|
7
VoiletWindowsActionTool.debug
Normal file
7
VoiletWindowsActionTool.debug
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"breakpoints": [
|
||||||
|
],
|
||||||
|
"timestamp": "1735569601958",
|
||||||
|
"watchvars": [
|
||||||
|
]
|
||||||
|
}
|
@ -1,80 +1,116 @@
|
|||||||
[Project]
|
[Project]
|
||||||
FileName=VoiletWindowsActionTool.dev
|
FileName = VoiletWindowsActionTool.dev
|
||||||
Name=VoiletWindowsActionTool
|
Name = VoiletWindowsActionTool
|
||||||
UnitCount=2
|
UnitCount = 2
|
||||||
Type=0
|
Type = 0
|
||||||
Ver=2
|
Ver = 3
|
||||||
ObjFiles=
|
ObjFiles =
|
||||||
Includes=
|
Includes =
|
||||||
Libs=
|
Libs =
|
||||||
PrivateResource=VoiletWindowsActionTool_private.rc
|
PrivateResource = VoiletWindowsActionTool_private.rc
|
||||||
ResourceIncludes=
|
ResourceIncludes =
|
||||||
MakeIncludes=
|
MakeIncludes =
|
||||||
Compiler=
|
Compiler =
|
||||||
CppCompiler=
|
CppCompiler =
|
||||||
Linker=
|
Linker =
|
||||||
IsCpp=0
|
IsCpp = 0
|
||||||
Icon=VoiletWindowsActionTool.ico
|
Icon = app.ico
|
||||||
ExeOutput=
|
ExeOutput =
|
||||||
ObjectOutput=
|
ObjectOutput =
|
||||||
LogOutput=
|
LogOutput =
|
||||||
LogOutputEnabled=0
|
LogOutputEnabled = 0
|
||||||
OverrideOutput=0
|
OverrideOutput = 0
|
||||||
OverrideOutputName=VoiletWindowsActionTool.exe
|
OverrideOutputName = VoiletWindowsActionTool.exe
|
||||||
HostApplication=
|
HostApplication =
|
||||||
UseCustomMakefile=0
|
UseCustomMakefile = 0
|
||||||
CustomMakefile=
|
CustomMakefile =
|
||||||
UsePrecompiledHeader=0
|
UsePrecompiledHeader = 0
|
||||||
PrecompiledHeader=
|
PrecompiledHeader =
|
||||||
CommandLine=
|
CommandLine =
|
||||||
Folders=
|
Folders =
|
||||||
IncludeVersionInfo=0
|
IncludeVersionInfo = 0
|
||||||
SupportXPThemes=0
|
SupportXPThemes = 0
|
||||||
CompilerSet=1
|
CompilerSet = 1
|
||||||
CompilerSettings=0000000000110000000001000
|
StaticLink = 1
|
||||||
StaticLink=1
|
AddCharset = 1
|
||||||
AddCharset=1
|
UseUTF8 = 1
|
||||||
UseUTF8=0
|
Bins =
|
||||||
|
ResourceCommand =
|
||||||
|
ExecEncoding = SYSTEM
|
||||||
|
Encoding = UTF-8
|
||||||
|
ModelType = 1
|
||||||
|
ClassBrowserType = 0
|
||||||
|
AllowParallelBuilding = false
|
||||||
|
ParellelBuildingJobs = 0
|
||||||
|
|
||||||
|
|
||||||
[Unit1]
|
[Unit1]
|
||||||
FileName=main.c
|
FileName = resource.rc
|
||||||
CompileCpp=0
|
CompileCpp = 0
|
||||||
Folder=
|
Folder = Resources
|
||||||
Compile=1
|
Compile = 1
|
||||||
Link=1
|
Link = 0
|
||||||
Priority=1000
|
Priority = 1000
|
||||||
OverrideBuildCmd=0
|
OverrideBuildCmd = 0
|
||||||
BuildCmd=
|
BuildCmd =
|
||||||
DetectEncoding=0
|
Encoding = 0
|
||||||
Encoding=0
|
FileEncoding = PROJECT
|
||||||
|
RealEncoding = ASCII
|
||||||
|
|
||||||
|
|
||||||
[VersionInfo]
|
[VersionInfo]
|
||||||
Major=1
|
Major = 1
|
||||||
Minor=0
|
Minor = 0
|
||||||
Release=0
|
Release = 0
|
||||||
Build=0
|
Build = 0
|
||||||
LanguageID=1033
|
LanguageID = 1033
|
||||||
CharsetID=1252
|
CharsetID = 1252
|
||||||
CompanyName=
|
CompanyName =
|
||||||
FileVersion=1.0.0.0
|
FileVersion = 1.0.0.0
|
||||||
FileDescription=Developed using the Dev-C++ IDE
|
FileDescription = Developed using the Dev-C++ IDE
|
||||||
InternalName=
|
InternalName =
|
||||||
LegalCopyright=
|
LegalCopyright =
|
||||||
LegalTrademarks=
|
LegalTrademarks =
|
||||||
OriginalFilename=
|
OriginalFilename = VoiletWindowsActionTool.exe
|
||||||
ProductName=
|
ProductName = VoiletWindowsActionTool
|
||||||
ProductVersion=1.0.0.0
|
ProductVersion = 1.0.0.0
|
||||||
AutoIncBuildNr=0
|
AutoIncBuildNr = 0
|
||||||
SyncProduct=1
|
SyncProduct = 1
|
||||||
|
|
||||||
|
|
||||||
[Unit2]
|
[Unit2]
|
||||||
FileName=resource.rc
|
FileName = main.c
|
||||||
Folder=Resources
|
Folder =
|
||||||
Compile=1
|
Compile = 1
|
||||||
Link=0
|
Link = 1
|
||||||
Priority=1000
|
Priority = 1000
|
||||||
OverrideBuildCmd=0
|
OverrideBuildCmd = 0
|
||||||
BuildCmd=
|
BuildCmd =
|
||||||
DetectEncoding=0
|
Encoding = 0
|
||||||
Encoding=0
|
CompileCpp = 0
|
||||||
|
FileEncoding = PROJECT
|
||||||
|
RealEncoding = UTF-8
|
||||||
|
|
||||||
|
|
||||||
|
[CompilerSettings]
|
||||||
|
c_cmd_opt_std = c99
|
||||||
|
cc_cmd_opt_abort_on_error =
|
||||||
|
cc_cmd_opt_address_sanitizer =
|
||||||
|
cc_cmd_opt_check_iso_conformance =
|
||||||
|
cc_cmd_opt_debug_info = on
|
||||||
|
cc_cmd_opt_inhibit_all_warning =
|
||||||
|
cc_cmd_opt_instruction =
|
||||||
|
cc_cmd_opt_optimize =
|
||||||
|
cc_cmd_opt_pointer_size =
|
||||||
|
cc_cmd_opt_profile_info =
|
||||||
|
cc_cmd_opt_stack_protector =
|
||||||
|
cc_cmd_opt_std =
|
||||||
|
cc_cmd_opt_syntax_only =
|
||||||
|
cc_cmd_opt_use_pipe =
|
||||||
|
cc_cmd_opt_warning_all = on
|
||||||
|
cc_cmd_opt_warning_as_error =
|
||||||
|
cc_cmd_opt_warning_extra =
|
||||||
|
link_cmd_opt_no_console =
|
||||||
|
link_cmd_opt_no_link_stdlib =
|
||||||
|
link_cmd_opt_stack_size = 12
|
||||||
|
link_cmd_opt_strip_exe =
|
||||||
|
Binary file not shown.
@ -1,13 +1,12 @@
|
|||||||
[Editors]
|
[
|
||||||
Order=0
|
{
|
||||||
Focused=0
|
"caretX": 24,
|
||||||
[Editor_0]
|
"caretY": 220,
|
||||||
CursorCol=6
|
"filename": "C:/Users/anonymous/Desktop/CApp/PandaCpp/VoiletWindowsActionTool/main.c",
|
||||||
CursorRow=249
|
"focused": true,
|
||||||
TopLine=232
|
"isOpen": true,
|
||||||
LeftChar=1
|
"left": 0,
|
||||||
[Editor_1]
|
"order": 0,
|
||||||
CursorCol=12
|
"top": 5100
|
||||||
CursorRow=1
|
}
|
||||||
TopLine=1
|
]
|
||||||
LeftChar=1
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */
|
/* THIS FILE WILL BE OVERWRITTEN BY Red Panda C++ */
|
||||||
/* DO NOT EDIT ! */
|
/* DO NOT EDIT ! */
|
||||||
|
|
||||||
#ifndef VOILETWINDOWSACTIONTOOL_PRIVATE_H
|
#ifndef VOILETWINDOWSACTIONTOOL_PRIVATE_H
|
||||||
@ -16,8 +16,8 @@
|
|||||||
#define INTERNAL_NAME ""
|
#define INTERNAL_NAME ""
|
||||||
#define LEGAL_COPYRIGHT ""
|
#define LEGAL_COPYRIGHT ""
|
||||||
#define LEGAL_TRADEMARKS ""
|
#define LEGAL_TRADEMARKS ""
|
||||||
#define ORIGINAL_FILENAME ""
|
#define ORIGINAL_FILENAME "VoiletWindowsActionTool.exe"
|
||||||
#define PRODUCT_NAME ""
|
#define PRODUCT_NAME "VoiletWindowsActionTool"
|
||||||
#define PRODUCT_VERSION "1.0.0.0"
|
#define PRODUCT_VERSION "1.0.0.0"
|
||||||
|
|
||||||
#endif /*VOILETWINDOWSACTIONTOOL_PRIVATE_H*/
|
#endif /*VOILETWINDOWSACTIONTOOL_PRIVATE_H*/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */
|
/* THIS FILE WILL BE OVERWRITTEN BY Red Panda C++ */
|
||||||
/* DO NOT EDIT! */
|
/* DO NOT EDIT! */
|
||||||
|
|
||||||
#include "resource.rc"
|
#include "resource.rc"
|
||||||
|
|
||||||
A ICON "VoiletWindowsActionTool.ico"
|
A ICON "app.ico"
|
||||||
|
543
main.c
543
main.c
@ -1,14 +1,14 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define START_ACTION_BTN_ID 1001 // 定义激活按钮 ID
|
#define START_ACTION_BTN_ID 1001 // 定义激活按钮 ID
|
||||||
|
|
||||||
#define ENGLISH 0 // 英文
|
#define ENGLISH 0 // 英文
|
||||||
#define CHINESE 1 // 中文
|
#define CHINESE 1 // 中文
|
||||||
|
|
||||||
#define INFO_LEFT_MARGIN 40 // 组件左侧边距
|
|
||||||
|
|
||||||
// 组件
|
#define INFO_LEFT_MARGIN 20 // 组件左侧边距
|
||||||
|
|
||||||
|
// 组件
|
||||||
WNDCLASSEX wc;
|
WNDCLASSEX wc;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
MSG msg;
|
MSG msg;
|
||||||
@ -18,14 +18,15 @@ HWND ActionServerText;
|
|||||||
HWND ActionServerAddr;
|
HWND ActionServerAddr;
|
||||||
HWND ActionBtn;
|
HWND ActionBtn;
|
||||||
|
|
||||||
|
static HFONT hFont; // 用于存储字体对象的句柄
|
||||||
|
|
||||||
// 当前语言选项
|
// 当前语言选项
|
||||||
int CurSystemLang = 0;
|
int CurSystemLang = CHINESE;
|
||||||
|
|
||||||
// 当前系统版本选项
|
// 当前系统版本选项
|
||||||
int CurSystemVersion = 0;
|
int CurSystemVersion = 0;
|
||||||
|
|
||||||
// 存放激活信息和对应显示语言信息的结构体
|
// 存放激活信息和对应显示语言信息的结构体
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char *Key;
|
char *Key;
|
||||||
@ -33,7 +34,7 @@ typedef struct
|
|||||||
char *Chinese;
|
char *Chinese;
|
||||||
}SYSTEM_VERSION,*SYSTEM_VERSION_PTR;
|
}SYSTEM_VERSION,*SYSTEM_VERSION_PTR;
|
||||||
|
|
||||||
//存放激活信息的结构体
|
//存放激活信息的结构体
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char *Key;
|
char *Key;
|
||||||
@ -41,73 +42,73 @@ typedef struct
|
|||||||
}ACTION_INFO,*ACTION_INFO_PTR;
|
}ACTION_INFO,*ACTION_INFO_PTR;
|
||||||
|
|
||||||
|
|
||||||
// 多语言列表
|
// 多语言列表
|
||||||
const char *SystemLangList[] = {
|
const char *SystemLangList[] = {
|
||||||
"English",
|
"English",
|
||||||
"简体中文",
|
"简体中文",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 激活服务器文本
|
// 激活服务器文本
|
||||||
const char *ActionServerStr[] = {
|
const char *ActionServerStr[] = {
|
||||||
"Action Server : ",
|
"Action Server : ",
|
||||||
"激活服务器 : ",
|
"激活服务器 : ",
|
||||||
};
|
};
|
||||||
|
|
||||||
// 激活按钮文本
|
// 激活按钮文本
|
||||||
const char *ActionBtnStr[] = {
|
const char *ActionBtnStr[] = {
|
||||||
"Start Action",
|
"Start Action",
|
||||||
"开始激活",
|
"开始激活",
|
||||||
};
|
};
|
||||||
|
|
||||||
ACTION_INFO ActionInfo;
|
ACTION_INFO ActionInfo;
|
||||||
|
|
||||||
//初始化版本信息
|
//初始化版本信息
|
||||||
const SYSTEM_VERSION SystemVersionList[] = {
|
const SYSTEM_VERSION SystemVersionList[] = {
|
||||||
{.Key = "FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4", .English = "Windows 7 Pro", .Chinese = "Windows 7 专业版"},
|
{.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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 数据中心版 半年"},
|
{.Key = "6NMRW-2C8FM-D24W7-TQWMY-CWH2D", .English = "Windows Server Datacenter Half Year", .Chinese = "Windows Server 数据中心版 半年"},
|
||||||
{.Key = NULL, .English = NULL, .Chinese = NULL},
|
{.Key = NULL, .English = NULL, .Chinese = NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -118,202 +119,223 @@ void RunSlmgrCommand(const char* command);
|
|||||||
void ExecActionCommand(void);
|
void ExecActionCommand(void);
|
||||||
|
|
||||||
|
|
||||||
/* 处理窗口消息的回调函数 */
|
/* 处理窗口消息的回调函数 */
|
||||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
|
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
|
||||||
|
|
||||||
char Buffer[256] = {0x00};
|
char Buffer[256] = {0x00};
|
||||||
|
|
||||||
switch(Message) {
|
switch(Message) {
|
||||||
// case WM_CREATE: {
|
case WM_CREATE:
|
||||||
// // 加载并设置窗口图标
|
{
|
||||||
// HICON hicon = (HICON)LoadImage(GetModuleHandleW(NULL), MAKEINTRESOURCE(IDI_ICON),
|
// 创建微软雅黑字体
|
||||||
// IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE);
|
hFont = CreateFont(
|
||||||
//
|
20, // 字体高度
|
||||||
// if (hicon)
|
0, // 字体宽度
|
||||||
// {
|
0, // 字符旋转角度
|
||||||
// SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hicon);
|
0, // 字符倾斜角度
|
||||||
// SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hicon);
|
FW_NORMAL, // 字体粗细
|
||||||
// } else {
|
FALSE, // 是否斜体
|
||||||
// MessageBox(NULL, "Failed to load icon!", "Error", MB_OK | MB_ICONERROR);
|
FALSE, // 是否下划线
|
||||||
// }
|
FALSE, // 是否删除线
|
||||||
// break;
|
DEFAULT_CHARSET, // 字符集
|
||||||
// }
|
OUT_TT_PRECIS, // 输出精度
|
||||||
case WM_DESTROY: {
|
CLIP_DEFAULT_PRECIS, // 剪辑精度
|
||||||
PostQuitMessage(0);
|
DEFAULT_QUALITY, // 输出质量
|
||||||
break;
|
DEFAULT_PITCH | FF_SWISS, // 字体类型
|
||||||
}
|
L"微软雅黑" // 字体名称
|
||||||
case WM_COMMAND:
|
);
|
||||||
// 激活按钮的点击事件
|
}
|
||||||
if (LOWORD(wParam) == START_ACTION_BTN_ID) { // 判断按钮是否被点击
|
break;
|
||||||
// 激活信息解析激活密钥
|
case WM_DESTROY: {
|
||||||
|
// 释放字体资源
|
||||||
|
if (hFont) {
|
||||||
|
DeleteObject(hFont);
|
||||||
|
hFont = NULL;
|
||||||
|
}
|
||||||
|
PostQuitMessage(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WM_COMMAND:
|
||||||
|
// 激活按钮的点击事件
|
||||||
|
if (LOWORD(wParam) == START_ACTION_BTN_ID) { // 判断按钮是否被点击
|
||||||
|
// 激活信息解析激活密钥
|
||||||
ActionInfo.Key = SystemVersionList[CurSystemVersion].Key;
|
ActionInfo.Key = SystemVersionList[CurSystemVersion].Key;
|
||||||
|
|
||||||
// 激活信息解析激活服务器地址
|
// 激活信息解析激活服务器地址
|
||||||
GetWindowText(ActionServerAddr,Buffer,sizeof(Buffer));
|
GetWindowText(ActionServerAddr,Buffer,sizeof(Buffer));
|
||||||
ActionInfo.ActionServer = Buffer;
|
ActionInfo.ActionServer = Buffer;
|
||||||
ExecActionCommand();
|
ExecActionCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 两个下拉列表的点击事件
|
// 两个下拉列表的点击事件
|
||||||
if (HIWORD(wParam) == CBN_SELCHANGE) {
|
if (HIWORD(wParam) == CBN_SELCHANGE) {
|
||||||
// 判断哪个 ComboBox 被选中
|
// 判断哪个 ComboBox 被选中
|
||||||
HWND hComboBox = (HWND)lParam;
|
HWND hComboBox = (HWND)lParam;
|
||||||
|
|
||||||
if (hComboBox == SystemLang)
|
if (hComboBox == SystemLang)
|
||||||
{
|
{
|
||||||
// 翻译软件
|
// 翻译软件
|
||||||
CurSystemLang = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
|
CurSystemLang = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
|
||||||
|
|
||||||
TranslateApp();
|
TranslateApp();
|
||||||
|
|
||||||
} else if (hComboBox == SystemVersion)
|
} else if (hComboBox == SystemVersion)
|
||||||
{
|
{
|
||||||
// 选中系统版本
|
// 选中系统版本
|
||||||
CurSystemVersion = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
|
CurSystemVersion = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
|
||||||
|
|
||||||
// 激活信息解析激活密钥
|
// 激活信息解析激活密钥
|
||||||
ActionInfo.Key = SystemVersionList[CurSystemVersion].Key;
|
ActionInfo.Key = SystemVersionList[CurSystemVersion].Key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return DefWindowProc(hwnd, Message, wParam, lParam);
|
return DefWindowProc(hwnd, Message, wParam, lParam);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Win32 程序的入口点 */
|
/* Win32 程序的入口点 */
|
||||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
|
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
|
||||||
|
|
||||||
memset(&wc,0,sizeof(wc));
|
memset(&wc,0,sizeof(wc));
|
||||||
wc.cbSize = sizeof(WNDCLASSEX);
|
wc.cbSize = sizeof(WNDCLASSEX);
|
||||||
wc.lpfnWndProc = WndProc;
|
wc.lpfnWndProc = WndProc;
|
||||||
wc.hInstance = hInstance;
|
wc.hInstance = hInstance;
|
||||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||||
wc.lpszClassName = "WindowClass";
|
wc.lpszClassName = "WindowClass";
|
||||||
wc.hIcon = LoadIcon(hInstance, "A");
|
wc.hIcon = LoadIcon(hInstance, "A");
|
||||||
wc.hIconSm = LoadIcon(hInstance, "A");
|
wc.hIconSm = LoadIcon(hInstance, "A");
|
||||||
|
|
||||||
if(!RegisterClassEx(&wc)) {
|
if(!RegisterClassEx(&wc)) {
|
||||||
MessageBox(NULL, "Window Registration Failed!","Error!",MB_ICONEXCLAMATION|MB_OK);
|
MessageBox(NULL, "Window Registration Failed!","Error!",MB_ICONEXCLAMATION|MB_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
hwnd = CreateWindowEx(
|
hwnd = CreateWindowEx(
|
||||||
WS_EX_CLIENTEDGE,
|
WS_EX_CLIENTEDGE,
|
||||||
"WindowClass",
|
"WindowClass",
|
||||||
"紫罗兰Windows激活工具v1.0",
|
"紫罗兰Windows激活工具v1.1.1",
|
||||||
WS_VISIBLE | WS_OVERLAPPEDWINDOW,
|
WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT, 450, 260,
|
CW_USEDEFAULT, CW_USEDEFAULT, 480, 260,
|
||||||
NULL, NULL, hInstance, NULL);
|
NULL, NULL, hInstance, NULL);
|
||||||
|
|
||||||
if(hwnd == NULL) {
|
if(hwnd == NULL) {
|
||||||
MessageBox(NULL, "Window Creation Failed!","Error!",MB_ICONEXCLAMATION|MB_OK);
|
MessageBox(NULL, "Window Creation Failed!","Error!",MB_ICONEXCLAMATION|MB_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 存放多语言下拉列表
|
// 存放多语言下拉列表
|
||||||
SystemLang = CreateWindowEx(
|
SystemLang = CreateWindowEx(
|
||||||
0, // 窗口扩展样式
|
0, // 窗口扩展样式
|
||||||
"COMBOBOX", // ComboBox 类名,注意这里是 "COMBOBOX"
|
"COMBOBOX", // ComboBox 类名,注意这里是 "COMBOBOX"
|
||||||
NULL, // 默认标题
|
NULL, // 默认标题
|
||||||
CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL, // ComboBox 样式
|
CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL, // ComboBox 样式
|
||||||
INFO_LEFT_MARGIN, 10, // x, y 位置
|
INFO_LEFT_MARGIN, 10, // x, y 位置
|
||||||
150, 200, // 宽度和高度
|
180, 200, // 宽度和高度
|
||||||
hwnd, // 父窗口句柄
|
hwnd, // 父窗口句柄
|
||||||
0, // 控件ID(可以用来识别控件)
|
0, // 控件ID(可以用来识别控件)
|
||||||
hInstance, // 实例句柄
|
hInstance, // 实例句柄
|
||||||
NULL // 无附加参数
|
NULL // 无附加参数
|
||||||
);
|
);
|
||||||
|
// 设置下拉列表的字体
|
||||||
|
SendMessage(SystemLang, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||||
|
|
||||||
// 将语言列表添加到下拉列表中
|
// 将语言列表添加到下拉列表中
|
||||||
for(int i = 0;i < GetSystemLangLen();i++){
|
for(int i = 0;i < GetSystemLangLen();i++){
|
||||||
// 向 ComboBox 添加选项
|
// 向 ComboBox 添加选项
|
||||||
SendMessage(SystemLang, CB_ADDSTRING, 0, (LPARAM)SystemLangList[i]);
|
SendMessage(SystemLang, CB_ADDSTRING, 0, (LPARAM)SystemLangList[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 默认选中第一个选项
|
// 默认选中第一个选项
|
||||||
SendMessage(SystemLang, CB_SETCURSEL, (WPARAM)0, 0);
|
SendMessage(SystemLang, CB_SETCURSEL, (WPARAM)CHINESE, 0);
|
||||||
|
|
||||||
// 存放系统列表
|
// 存放系统列表
|
||||||
SystemVersion = CreateWindowEx(
|
SystemVersion = CreateWindowEx(
|
||||||
0, // 窗口扩展样式
|
0, // 窗口扩展样式
|
||||||
"COMBOBOX", // ComboBox 类名,注意这里是 "COMBOBOX"
|
"COMBOBOX", // ComboBox 类名,注意这里是 "COMBOBOX"
|
||||||
NULL, // 默认标题
|
NULL, // 默认标题
|
||||||
CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL, // ComboBox 样式
|
CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL, // ComboBox 样式
|
||||||
INFO_LEFT_MARGIN, 50, // x, y 位置
|
INFO_LEFT_MARGIN, 50, // x, y 位置
|
||||||
350, 500, // 宽度和高度
|
420, 500, // 宽度和高度
|
||||||
hwnd, // 父窗口句柄
|
hwnd, // 父窗口句柄
|
||||||
1, // 控件ID(可以用来识别控件)
|
1, // 控件ID(可以用来识别控件)
|
||||||
hInstance, // 实例句柄
|
hInstance, // 实例句柄
|
||||||
NULL // 无附加参数
|
NULL // 无附加参数
|
||||||
);
|
);
|
||||||
|
// 设置下拉列表的字体
|
||||||
// 将系统版本添加到下拉列表中
|
SendMessage(SystemVersion, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||||
|
|
||||||
|
// 将系统版本添加到下拉列表中
|
||||||
for(int i = 0;i < GetSystemListLen();i++){
|
for(int i = 0;i < GetSystemListLen();i++){
|
||||||
// 向 ComboBox 添加选项
|
// 向 ComboBox 添加选项
|
||||||
SendMessage(SystemVersion, CB_ADDSTRING, 0, (LPARAM)SystemVersionList[i].English);
|
SendMessage(SystemVersion, CB_ADDSTRING, 0, (LPARAM)SystemVersionList[i].English);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 默认选中第一个选项
|
// 默认选中第一个选项
|
||||||
SendMessage(SystemVersion, CB_SETCURSEL, (WPARAM)0, 0);
|
SendMessage(SystemVersion, CB_SETCURSEL, (WPARAM)0, 0);
|
||||||
|
|
||||||
|
|
||||||
// 激活服务器标签
|
// 激活服务器标签
|
||||||
ActionServerText = CreateWindowEx(
|
ActionServerText = CreateWindowEx(
|
||||||
0, // 窗口扩展样式
|
0, // 窗口扩展样式
|
||||||
"STATIC", // 标签类名
|
"STATIC", // 标签类名
|
||||||
ActionServerStr[CurSystemLang], // 标签文本
|
ActionServerStr[CurSystemLang], // 标签文本
|
||||||
WS_VISIBLE | WS_CHILD, // 标签样式
|
WS_VISIBLE | WS_CHILD, // 标签样式
|
||||||
INFO_LEFT_MARGIN, 90, // x, y 位置
|
INFO_LEFT_MARGIN, 90, // x, y 位置
|
||||||
150, 20, // 宽度和高度
|
180, 20, // 宽度和高度
|
||||||
hwnd, // 父窗口句柄
|
hwnd, // 父窗口句柄
|
||||||
NULL, // 控件ID
|
NULL, // 控件ID
|
||||||
hInstance, // 实例句柄
|
hInstance, // 实例句柄
|
||||||
NULL // 附加参数
|
NULL // 附加参数
|
||||||
);
|
);
|
||||||
|
// 设置下拉列表的字体
|
||||||
|
SendMessage(ActionServerText, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||||
|
|
||||||
// 创建一个输入框(编辑控件)
|
// 创建一个输入框(编辑控件)
|
||||||
ActionServerAddr = CreateWindowEx(
|
ActionServerAddr = CreateWindowEx(
|
||||||
0, // 窗口扩展样式
|
0, // 窗口扩展样式
|
||||||
"EDIT", // 控件类名
|
"EDIT", // 控件类名
|
||||||
"kms.03k.org", // 默认文本
|
"kms.03k.org", // 默认文本
|
||||||
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT, // 样式
|
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT, // 样式
|
||||||
INFO_LEFT_MARGIN, 120, // x, y 位置
|
INFO_LEFT_MARGIN, 120, // x, y 位置
|
||||||
150, 24, // 宽度和高度
|
180, 24, // 宽度和高度
|
||||||
hwnd, // 父窗口句柄
|
hwnd, // 父窗口句柄
|
||||||
NULL, // 控件ID
|
NULL, // 控件ID
|
||||||
hInstance, // 实例句柄
|
hInstance, // 实例句柄
|
||||||
NULL // 附加参数
|
NULL // 附加参数
|
||||||
);
|
);
|
||||||
|
// 设置下拉列表的字体
|
||||||
|
SendMessage(ActionServerAddr, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||||
|
|
||||||
// 激活按钮
|
// 激活按钮
|
||||||
ActionBtn = CreateWindowEx(
|
ActionBtn = CreateWindowEx(
|
||||||
0, // 窗口扩展样式
|
0, // 窗口扩展样式
|
||||||
"BUTTON", // 按钮类名
|
"BUTTON", // 按钮类名
|
||||||
ActionBtnStr[CurSystemLang], // 按钮文本
|
ActionBtnStr[CurSystemLang], // 按钮文本
|
||||||
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, // 按钮样式
|
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, // 按钮样式
|
||||||
INFO_LEFT_MARGIN, 160, // x, y 位置
|
INFO_LEFT_MARGIN, 160, // x, y 位置
|
||||||
100, 30, // 宽度和高度
|
150, 30, // 宽度和高度
|
||||||
hwnd, // 父窗口句柄
|
hwnd, // 父窗口句柄
|
||||||
START_ACTION_BTN_ID, // 控件ID
|
START_ACTION_BTN_ID, // 控件ID
|
||||||
hInstance, // 实例句柄
|
hInstance, // 实例句柄
|
||||||
NULL // 附加参数
|
NULL // 附加参数
|
||||||
);
|
);
|
||||||
|
// 设置下拉列表的字体
|
||||||
|
SendMessage(ActionBtn, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||||
|
|
||||||
|
// 消息循环
|
||||||
// 消息循环
|
while(GetMessage(&msg, NULL, 0, 0) > 0) {
|
||||||
while(GetMessage(&msg, NULL, 0, 0) > 0) {
|
TranslateMessage(&msg);
|
||||||
TranslateMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
}
|
||||||
}
|
|
||||||
|
return msg.wParam;
|
||||||
return msg.wParam;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取多语言选项列表长度
|
// 获取多语言选项列表长度
|
||||||
int GetSystemLangLen(void)
|
int GetSystemLangLen(void)
|
||||||
{
|
{
|
||||||
int SystemLangNum = 0x00;
|
int SystemLangNum = 0x00;
|
||||||
@ -332,7 +354,7 @@ int GetSystemLangLen(void)
|
|||||||
return (SystemLangNum);
|
return (SystemLangNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取系统版本列表的长度
|
// 获取系统版本列表的长度
|
||||||
int GetSystemListLen(void)
|
int GetSystemListLen(void)
|
||||||
{
|
{
|
||||||
int SystemListNum = 0x00;
|
int SystemListNum = 0x00;
|
||||||
@ -351,52 +373,50 @@ int GetSystemListLen(void)
|
|||||||
return (SystemListNum);
|
return (SystemListNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 执行slmgr命令
|
// 执行slmgr命令
|
||||||
void RunSlmgrCommand(const char* command)
|
void RunSlmgrCommand(const char* command)
|
||||||
{
|
{
|
||||||
// 创建完整的命令字符串
|
// 创建完整的命令字符串
|
||||||
char fullCommand[256];
|
char fullCommand[256];
|
||||||
snprintf(fullCommand, sizeof(fullCommand), "cmd.exe /c %s", command);
|
snprintf(fullCommand, sizeof(fullCommand), "cmd.exe /c %s", command);
|
||||||
|
|
||||||
// 执行命令
|
// 执行命令
|
||||||
ShellExecute(NULL, "runas", "cmd.exe", fullCommand, NULL, SW_SHOWNORMAL);
|
ShellExecute(NULL, "runas", "cmd.exe", fullCommand, NULL, SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 安装密钥
|
// 安装密钥
|
||||||
void InstallKey(void)
|
void InstallKey(void)
|
||||||
{
|
{
|
||||||
char BaseCmd[256] = {"slmgr /ipk "};
|
char BaseCmd[256] = {"slmgr /ipk "};
|
||||||
|
|
||||||
snprintf(BaseCmd + strlen(BaseCmd), sizeof(BaseCmd) - strlen(BaseCmd), "%s", ActionInfo.Key);
|
snprintf(BaseCmd + strlen(BaseCmd), sizeof(BaseCmd) - strlen(BaseCmd), "%s", ActionInfo.Key);
|
||||||
|
|
||||||
RunSlmgrCommand(BaseCmd);
|
RunSlmgrCommand(BaseCmd);
|
||||||
|
|
||||||
//MessageBox(hwnd, BaseCmd, "提示", MB_OK | MB_ICONINFORMATION);
|
//MessageBox(hwnd, BaseCmd, "提示", MB_OK | MB_ICONINFORMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置激活服务器
|
// 设置激活服务器
|
||||||
void SetActionServer(void)
|
void SetActionServer(void)
|
||||||
{
|
{
|
||||||
char BaseCmd[256] = {"slmgr /skms "};
|
char BaseCmd[256] = {"slmgr /skms "};
|
||||||
|
|
||||||
snprintf(BaseCmd + strlen(BaseCmd), sizeof(BaseCmd) - strlen(BaseCmd), "%s", ActionInfo.ActionServer);
|
snprintf(BaseCmd + strlen(BaseCmd), sizeof(BaseCmd) - strlen(BaseCmd), "%s", ActionInfo.ActionServer);
|
||||||
|
|
||||||
RunSlmgrCommand(BaseCmd);
|
RunSlmgrCommand(BaseCmd);
|
||||||
|
|
||||||
//MessageBox(hwnd, BaseCmd, "提示", MB_OK | MB_ICONINFORMATION);
|
//MessageBox(hwnd, BaseCmd, "提示", MB_OK | MB_ICONINFORMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 开始激活
|
// 开始激活
|
||||||
void StartAction(void)
|
void StartAction(void)
|
||||||
{
|
{
|
||||||
char BaseCmd[256] = {"slmgr /ato "};
|
char BaseCmd[256] = {"slmgr /ato "};
|
||||||
|
|
||||||
RunSlmgrCommand(BaseCmd);
|
RunSlmgrCommand(BaseCmd);
|
||||||
|
|
||||||
//MessageBox(hwnd, BaseCmd, "提示", MB_OK | MB_ICONINFORMATION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 开始执行激活命令
|
// 开始执行激活命令
|
||||||
void ExecActionCommand(void)
|
void ExecActionCommand(void)
|
||||||
{
|
{
|
||||||
InstallKey();
|
InstallKey();
|
||||||
@ -405,59 +425,60 @@ void ExecActionCommand(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//翻译至英文
|
//翻译至英文
|
||||||
void TranslateEnglish(void)
|
void TranslateEnglish(void)
|
||||||
{
|
{
|
||||||
//清空系统版本列表
|
//清空系统版本列表
|
||||||
SendMessage(SystemVersion, CB_RESETCONTENT, 0, 0);
|
SendMessage(SystemVersion, CB_RESETCONTENT, 0, 0);
|
||||||
|
|
||||||
//重新添加
|
//重新添加
|
||||||
// 将系统版本添加到下拉列表中
|
// 将系统版本添加到下拉列表中
|
||||||
for(int i = 0;i < GetSystemListLen();i++){
|
for(int i = 0;i < GetSystemListLen();i++){
|
||||||
// 向 ComboBox 添加选项
|
// 向 ComboBox 添加选项
|
||||||
SendMessage(SystemVersion, CB_ADDSTRING, 0, (LPARAM)SystemVersionList[i].English);
|
SendMessage(SystemVersion, CB_ADDSTRING, 0, (LPARAM)SystemVersionList[i].English);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改激活服务器文本标签
|
// 修改激活服务器文本标签
|
||||||
SendMessage(ActionServerText, WM_SETTEXT, 0, (LPARAM)ActionServerStr[CurSystemLang]);
|
SendMessage(ActionServerText, WM_SETTEXT, 0, (LPARAM)ActionServerStr[CurSystemLang]);
|
||||||
|
|
||||||
// 修改激活按钮的文本
|
// 修改激活按钮的文本
|
||||||
SendMessage(ActionBtn, WM_SETTEXT, 0, (LPARAM)ActionBtnStr[CurSystemLang]);
|
SendMessage(ActionBtn, WM_SETTEXT, 0, (LPARAM)ActionBtnStr[CurSystemLang]);
|
||||||
}
|
}
|
||||||
//翻译至中文
|
//翻译至中文
|
||||||
void TranslateChinese(void)
|
void TranslateChinese(void)
|
||||||
{
|
{
|
||||||
SendMessage(SystemVersion, CB_RESETCONTENT, 0, 0);
|
SendMessage(SystemVersion, CB_RESETCONTENT, 0, 0);
|
||||||
|
|
||||||
//重新添加
|
//重新添加
|
||||||
// 将系统版本添加到下拉列表中
|
// 将系统版本添加到下拉列表中
|
||||||
for(int i = 0;i < GetSystemListLen();i++){
|
for(int i = 0;i < GetSystemListLen();i++){
|
||||||
// 向 ComboBox 添加选项
|
// 向 ComboBox 添加选项
|
||||||
SendMessage(SystemVersion, CB_ADDSTRING, 0, (LPARAM)SystemVersionList[i].Chinese);
|
SendMessage(SystemVersion, CB_ADDSTRING, 0, (LPARAM)SystemVersionList[i].Chinese);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改激活服务器文本标签
|
// 修改激活服务器文本标签
|
||||||
SendMessage(ActionServerText, WM_SETTEXT, 0, (LPARAM)ActionServerStr[CurSystemLang]);
|
SendMessage(ActionServerText, WM_SETTEXT, 0, (LPARAM)ActionServerStr[CurSystemLang]);
|
||||||
|
|
||||||
// 修改激活按钮的文本
|
// 修改激活按钮的文本
|
||||||
SendMessage(ActionBtn, WM_SETTEXT, 0, (LPARAM)ActionBtnStr[CurSystemLang]);
|
SendMessage(ActionBtn, WM_SETTEXT, 0, (LPARAM)ActionBtnStr[CurSystemLang]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//翻译软件
|
//翻译软件
|
||||||
void TranslateApp(void)
|
void TranslateApp(void)
|
||||||
{
|
{
|
||||||
switch (CurSystemLang) {
|
switch (CurSystemLang) {
|
||||||
case ENGLISH:
|
case ENGLISH:
|
||||||
TranslateEnglish();
|
TranslateEnglish();
|
||||||
break;
|
break;
|
||||||
case CHINESE:
|
case CHINESE:
|
||||||
TranslateChinese();
|
TranslateChinese();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
TranslateEnglish();
|
TranslateEnglish();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 默认系统版本选中第一个选项
|
// 默认系统版本选中第一个选项
|
||||||
SendMessage(SystemVersion, CB_SETCURSEL, (WPARAM)0, 0);
|
SendMessage(SystemVersion, CB_SETCURSEL, (WPARAM)0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user