39 int guiLevel = GUI_FULL;
41 if (lpCmdLine && lpCmdLine[0])
44 wchar_t **wArgv = CommandLineToArgvW(lpCmdLine, &argc);
61 for (
int index = 0; index < argc; index ++)
63 argv[index + 1] = NULL;
67 int length = WideCharToMultiByte(CP_UTF8, 0, wArgv[index], -1, NULL, 0, NULL, NULL);
71 argv[index + 1] = calloc(length,
sizeof(
char));
75 WideCharToMultiByte(CP_UTF8, 0, wArgv[index], -1, argv[index + 1], length, NULL, NULL);
84 BOOL p_openProject = FALSE;
85 char *projectToOpen = NULL;
104 while ((option = getopt(argc, argv,
":p:i")) != -1)
112 p_openProject = TRUE;
113 projectToOpen = optarg;
146 p_openProject = TRUE;
147 projectToOpen = argv[optind];
155 if (projectToOpen && projectToOpen[0])
157 size_t length = strlen(projectToOpen) + 1;
158 wchar_t *wProjectToOpen = calloc(length,
sizeof(
wchar_t));
165 MultiByteToWideChar(CP_UTF8, 0, projectToOpen, -1, wProjectToOpen, length);
168 free(wProjectToOpen);
180 for (
int index = 1; index <= argc; index ++)
207 HINSTANCE hPrevInstance __attribute__((unused)),
208 LPWSTR lpCmdLine __attribute__((unused)),
209 int nShowCmd __attribute__((unused)))
211 HANDLE hMutex = CreateMutex(NULL, FALSE, L
"mutex " SOFT_NAMEW);
213 if (GetLastError() == ERROR_ALREADY_EXISTS)
220 SetForegroundWindow(hwnd);
223 ReleaseMutex(hMutex);
241 WNDCLASSEX f_classe = {0};
243 f_classe.hInstance = hInstance;
244 f_classe.lpszClassName = L
"mainWindowClass";
246 f_classe.style = CS_HREDRAW | CS_VREDRAW;
247 f_classe.cbSize =
sizeof(WNDCLASSEX);
250 f_classe.hIcon = LoadIcon(hInstance, L
"mainIcon");
251 f_classe.hIconSm = LoadIcon(hInstance, L
"mainIcon");
252 f_classe.hCursor = LoadCursor(NULL, IDC_ARROW);
253 f_classe.lpszMenuName = L
"MainMenu";
254 f_classe.cbClsExtra = 0;
255 f_classe.cbWndExtra = 0;
264 if (!RegisterClassEx(&f_classe))
270 ReleaseMutex(hMutex);
277 HWND hwnd = CreateWindowEx(
281 WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS,
292 ApplyDarkMode(hwnd, L
"DarkMode_Explorer");
301 ShowWindow(hwnd, SW_NORMAL);
307 ShowWindow(hwnd, SW_HIDE);
313 ShowWindow(hwnd, SW_HIDE);
319 ShowWindow(hwnd, SW_NORMAL);
328 ZeroMemory(&msg,
sizeof(msg));
333 if (msg.message == WM_QUIT)
341 if (GetMessage(&msg, NULL, 0, 0) > 0)
343 TranslateMessage(&msg);
344 DispatchMessage(&msg);
354 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.