From b2af67acca3d2088fefbf00122d48ed0e3644227 Mon Sep 17 00:00:00 2001 From: Acid Date: Sat, 21 Mar 2026 18:05:21 -0400 Subject: [PATCH] fixed args not being passed --- ClassicNotepad.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ClassicNotepad.c b/ClassicNotepad.c index 9b8b783..961f3f5 100644 --- a/ClassicNotepad.c +++ b/ClassicNotepad.c @@ -35,7 +35,7 @@ int swprintf_s(wchar_t *buffer, size_t sizeOfBuffer, const wchar_t *format, ...) #define IDM_HELP_ABOUT 4001 -static const WCHAR APP_VERSION[] = L"1.1.0"; +static const WCHAR APP_VERSION[] = L"1.2.0"; static HWND g_hEdit = NULL; static HFONT g_hFont = NULL; @@ -968,7 +968,6 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) { (void)hPrevInstance; - (void)lpCmdLine; { HMODULE hUser = GetModuleHandleW(L"user32.dll"); @@ -1046,6 +1045,17 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); + if (lpCmdLine && lpCmdLine[0]) + { + int argc; + LPWSTR *argv = CommandLineToArgvW(lpCmdLine, &argc); + if (argv && argc >= 2) + { + LoadFileToEdit(hwnd, argv[1]); + } + if (argv) LocalFree(argv); + } + MSG msg; while (GetMessageW(&msg, NULL, 0, 0) > 0) {