convert from console app to proper windowed app
This commit is contained in:
@@ -7,12 +7,12 @@ import("//build/config/win/manifest.gni")
|
||||
# Main executable
|
||||
executable("xp_activate32") {
|
||||
configs -= [
|
||||
#"//build/config/win:console",
|
||||
#"//build/config/win:nominmax",
|
||||
"//build/config/win:console",
|
||||
"//build/config/win:nominmax",
|
||||
]
|
||||
|
||||
configs += [
|
||||
#"//build/config/win:windowed",
|
||||
"//build/config/win:windowed",
|
||||
":xp_activate32_config",
|
||||
]
|
||||
|
||||
@@ -32,7 +32,7 @@ source_set("xp_activate32_sources") {
|
||||
configs -= [ "//build/config/win:nominmax", ]
|
||||
|
||||
# Must explicitly set this for sources
|
||||
#configs += [ "//build/config/win:windowed", ]
|
||||
configs += [ "//build/config/win:windowed", ]
|
||||
|
||||
configs += [
|
||||
":xp_activate32_config",
|
||||
|
||||
+22
-2
@@ -972,7 +972,27 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int WINAPI wWinMain(_In_ HINSTANCE hInstance,
|
||||
_In_opt_ HINSTANCE hPrevInstance,
|
||||
_In_ WCHAR *pCmdLine,
|
||||
_In_ INT nCmdShow) {
|
||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
|
||||
// Allow and allocate conhost
|
||||
if (!AllocConsole()) {
|
||||
return 1;
|
||||
}
|
||||
// File handler pointer to a dummy file, possibly an actual logfile
|
||||
FILE* fNonExistFile = fDummyFile;
|
||||
freopen_s(&fNonExistFile, "CONOUT$", "w", stdout);
|
||||
freopen_s(&fNonExistFile, "CONOUT$", "w", stderr);
|
||||
|
||||
LPWSTR cmdLine = GetCommandLineW();
|
||||
if (cmdLine == nullptr || cmdLine == NULL) {
|
||||
std::wcerr << L"GetCommandLineW failed!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::wstring welcome_str = L"Welcome to XP_Activate32 ver. " + getVersionW();
|
||||
std::wcout << welcome_str << std::endl;
|
||||
INITCOMMONCONTROLSEX cc = {sizeof(INITCOMMONCONTROLSEX), ICC_STANDARD_CLASSES};
|
||||
@@ -989,7 +1009,7 @@ int main() {
|
||||
hIcon[i] = getDialogIcon(false, 194, x, y);
|
||||
}
|
||||
|
||||
INT_PTR status = DialogBox(NULL, MAKEINTRESOURCE(100), NULL, &DialogProc);
|
||||
INT_PTR status = DialogBoxW(NULL, MAKEINTRESOURCE(100), NULL, &DialogProc);
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
DestroyIcon(hIcon[i]);
|
||||
|
||||
+1
-7
@@ -93,12 +93,6 @@ static void PutIdToSystem(HWND hDlg);
|
||||
|
||||
INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
std::wstring getVersionW();
|
||||
|
||||
HANDLE LoadImageFromDLL(UINT resourceId,
|
||||
UINT imgType,
|
||||
int width,
|
||||
int height,
|
||||
UINT flags);
|
||||
static FILE* fDummyFile;
|
||||
|
||||
#endif // XP_ACTIVATE32_H_
|
||||
|
||||
@@ -74,13 +74,13 @@
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_WIN32;DEBUG;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN32;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<MinimumRequiredVersion>5.01</MinimumRequiredVersion>
|
||||
<GenerateWindowsMetadata>true</GenerateWindowsMetadata>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -93,13 +93,13 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_WIN32;NDEBUG;_NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN32;NDEBUG;_NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<MinimumRequiredVersion>5.01</MinimumRequiredVersion>
|
||||
<GenerateWindowsMetadata>true</GenerateWindowsMetadata>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
@@ -112,13 +112,13 @@
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_WIN32;WIN64;_WIN64;DEBUG;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN32;WIN64;_WIN64;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<MinimumRequiredVersion>5.02</MinimumRequiredVersion>
|
||||
<GenerateWindowsMetadata>true</GenerateWindowsMetadata>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -131,13 +131,13 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_WIN32;WIN64;_WIN64;NDEBUG;_NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WIN32;WIN64;_WIN64;NDEBUG;_NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<MinimumRequiredVersion>5.02</MinimumRequiredVersion>
|
||||
<GenerateWindowsMetadata>true</GenerateWindowsMetadata>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
|
||||
Reference in New Issue
Block a user