diff --git a/setup/windows/CMakeLists.txt b/setup/windows/CMakeLists.txt
index 4f1ec280..2dbba390 100644
--- a/setup/windows/CMakeLists.txt
+++ b/setup/windows/CMakeLists.txt
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.14)
-
project(novelWriter LANGUAGES CXX)
-
add_executable(novelWriter main.cpp launcher.rc)
+set_target_properties(novelWriter PROPERTIES WIN32_EXECUTABLE True)
diff --git a/setup/windows/launcher.rc b/setup/windows/launcher.rc
index f6809018..691bb1d2 100644
--- a/setup/windows/launcher.rc
+++ b/setup/windows/launcher.rc
@@ -1,7 +1,7 @@
IDI_ICON1 ICON DISCARDABLE "novelWriter.ico"
1 VERSIONINFO
-FILEVERSION 1,1,0,0
-PRODUCTVERSION 1,1,0,0
+FILEVERSION 1,2,0,0
+PRODUCTVERSION 1,2,0,0
FILEOS 0x4
FILETYPE 0x1
{
@@ -9,11 +9,11 @@ FILETYPE 0x1
BLOCK "040904b0" {
VALUE "CompanyName", "Veronica Berglyd Olsen\0"
VALUE "FileDescription", "novelWriter Launcher\0"
- VALUE "FileVersion", "1.1.0.0\0"
+ VALUE "FileVersion", "1.2.0.0\0"
VALUE "LegalCopyright", "(c) 2025 Veronica Berglyd Olsen\0"
VALUE "OriginalFilename", "novelWriter.exe\0"
VALUE "ProductName", "novelWriter\0"
- VALUE "ProductVersion", "1.1.0.0\0"
+ VALUE "ProductVersion", "1.2.0.0\0"
}
}
BLOCK "VarFileInfo" {
diff --git a/setup/windows/main.cpp b/setup/windows/main.cpp
index 4f2121b3..26e7fd75 100644
--- a/setup/windows/main.cpp
+++ b/setup/windows/main.cpp
@@ -19,12 +19,15 @@
** along with this program. If not, see .
*/
+#ifndef UNICODE
+#define UNICODE
+#endif
+
#include
#include
-#include
-#include
-void _tmain(int argc, TCHAR *argv[]) {
+int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) {
+
STARTUPINFO si;
PROCESS_INFORMATION pi;
@@ -32,21 +35,18 @@ void _tmain(int argc, TCHAR *argv[]) {
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
- TCHAR path[MAX_PATH];
- auto pathlen = GetModuleFileName(NULL, path, MAX_PATH);
+ wchar_t path[MAX_PATH];
+ auto pathlen = GetModuleFileNameW(NULL, path, MAX_PATH);
path[pathlen - 15] = 0;
SetCurrentDirectory(path);
- std::cout << "WorkDir: " << path << std::endl;
- TCHAR cmd[MAX_PATH] = TEXT("pythonw.exe novelWriter.pyw");
- if (argc > 1) {
- _tcscat_s(cmd, TEXT(" "));
- _tcscat_s(cmd, argv[1]);
+ wchar_t cmd[MAX_PATH] = L"pythonw.exe novelWriter.pyw";
+ if (__argc > 1) {
+ wcsncat_s(cmd, L" ", 1);
+ wcsncat_s(cmd, __wargv[1], MAX_PATH-28);
}
- std::cout << "Command: " << cmd << std::endl;
- std::cout << "Launching novelWriter GUI" << std::endl;
CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
- return;
+ return 0;
}
diff --git a/setup/windows/novelWriter.exe b/setup/windows/novelWriter.exe
index 9cce6d42..f50363fe 100644
Binary files a/setup/windows/novelWriter.exe and b/setup/windows/novelWriter.exe differ
diff --git a/utils/build_windows.py b/utils/build_windows.py
index 1a94632a..e3cbd6bf 100644
--- a/utils/build_windows.py
+++ b/utils/build_windows.py
@@ -209,6 +209,9 @@ def main(args: argparse.Namespace) -> None:
installRequirements(libDir)
removeRedundantQt(libDir)
+ print("Copy redistributable to root ...")
+ shutil.copyfile(libDir / "PyQt6" / "Qt6" / "bin" / "msvcp140.dll", outDir / "msvcp140.dll")
+
print("Updating starting script ...")
writeFile(outDir / "novelWriter.pyw", (
"#!/usr/bin/env python3\n"