137 int guiLevel = GUI_FULL;
139 if (lpCmdLine && lpCmdLine[0])
142 wchar_t **wArgv = CommandLineToArgvW(lpCmdLine, &argc);
155 char *argv[argc + 1];
159 for (
int index = 0; index < argc; index ++)
161 argv[index + 1] = NULL;
165 int length = WideCharToMultiByte(CP_UTF8, 0, wArgv[index], -1, NULL, 0, NULL, NULL);
169 argv[index + 1] = calloc(length,
sizeof(
char));
173 WideCharToMultiByte(CP_UTF8, 0, wArgv[index], -1, argv[index + 1], length, NULL, NULL);
182 BOOL p_openProject = FALSE;
183 char *projectToOpen = NULL;
202 while ((option = getopt(argc, argv,
":p:i")) != -1)
210 p_openProject = TRUE;
211 projectToOpen = optarg;
242 p_openProject = TRUE;
243 projectToOpen = argv[optind];
251 if (projectToOpen && projectToOpen[0])
253 size_t length = strlen(projectToOpen) + 1;
254 wchar_t *wProjectToOpen = calloc(length,
sizeof(
wchar_t));
258 MultiByteToWideChar(CP_UTF8, 0, projectToOpen, -1, wProjectToOpen, length);
261 free(wProjectToOpen);
273 for (
int index = 1; index <= argc; index ++)
300 HINSTANCE hPrevInstance __attribute__((unused)),
301 LPWSTR lpCmdLine __attribute__((unused)),
302 int nShowCmd __attribute__((unused)))
304 HANDLE hMutex = CreateMutex(NULL, FALSE, L
"mutex " SOFT_NAMEW);
306 if (GetLastError() == ERROR_ALREADY_EXISTS)
313 SetForegroundWindow(hwnd);
316 ReleaseMutex(hMutex);
331 WNDCLASSEX f_classe = {0};
333 f_classe.hInstance = hInstance;
334 f_classe.lpszClassName = L
"mainWindowClass";
336 f_classe.style = CS_HREDRAW | CS_VREDRAW;
337 f_classe.cbSize =
sizeof(WNDCLASSEX);
340 f_classe.hIcon = LoadIcon(hInstance, L
"mainIcon");
341 f_classe.hIconSm = LoadIcon(hInstance, L
"mainIcon");
342 f_classe.hCursor = LoadCursor(NULL, IDC_ARROW);
343 f_classe.lpszMenuName = L
"MainMenu";
344 f_classe.cbClsExtra = 0;
345 f_classe.cbWndExtra = 0;
354 if (!RegisterClassEx(&f_classe))
359 ReleaseMutex(hMutex);
366 HWND hwnd = CreateWindowEx(
370 WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS,
381 ApplyDarkMode(hwnd, L
"DarkMode_Explorer");
390 ShowWindow(hwnd, SW_NORMAL);
396 ShowWindow(hwnd, SW_HIDE);
402 ShowWindow(hwnd, SW_HIDE);
408 ShowWindow(hwnd, SW_NORMAL);
417 ZeroMemory(&msg,
sizeof(msg));
421 if (msg.message == WM_QUIT)
429 if (GetMessage(&msg, NULL, 0, 0) > 0)
431 TranslateMessage(&msg);
432 DispatchMessage(&msg);
440 ReleaseMutex(hMutex);
LRESULT CALLBACK Main_Procedure(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
procédure de la fenêtre principale.
static int ProcessCommandLine(HWND hwnd, wchar_t *lpCmdLine)
Traite les éventuels arguments passés au lancement de Taupie.
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
Procédure principale - point d'entrée du programme.