fixed args not being passed

This commit is contained in:
Acid
2026-03-21 18:05:21 -04:00
parent 08253a25ed
commit b2af67acca
+12 -2
View File
@@ -35,7 +35,7 @@ int swprintf_s(wchar_t *buffer, size_t sizeOfBuffer, const wchar_t *format, ...)
#define IDM_HELP_ABOUT 4001 #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 HWND g_hEdit = NULL;
static HFONT g_hFont = 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) int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{ {
(void)hPrevInstance; (void)hPrevInstance;
(void)lpCmdLine;
{ {
HMODULE hUser = GetModuleHandleW(L"user32.dll"); HMODULE hUser = GetModuleHandleW(L"user32.dll");
@@ -1046,6 +1045,17 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd
ShowWindow(hwnd, nCmdShow); ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd); 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; MSG msg;
while (GetMessageW(&msg, NULL, 0, 0) > 0) while (GetMessageW(&msg, NULL, 0, 0) > 0)
{ {