NSIS_ENTRYPOINT_SIMPLEGUI int WINAPI _tWinMain(HINSTANCE hInst,HINSTANCE hOldInst,LPTSTR CmdLineParams,int ShowCmd) { MSG msg; int status; HACCEL haccel; memset(&g_sdata,0,sizeof(NSCRIPTDATA)); memset(&g_resize,0,sizeof(NRESIZEDATA)); memset(&g_find,0,sizeof(NFINDREPLACE)); g_sdata.hInstance = hInst; g_sdata.symbols = NULL; g_sdata.sigint_event_legacy = CreateEvent(NULL, FALSE, FALSE, MakensisAPI::SigintEventNameLegacy); g_sdata.verbosity = (unsigned char) ReadRegSettingDW(REGVERBOSITY, 4); if (g_sdata.verbosity > 4) g_sdata.verbosity = 4; RestoreSymbols(); HINSTANCE hRichEditDLL = LoadLibrary(_T("RichEd20.dll")); if (!InitBranding()) { MessageBox(0,NSISERROR,ERRBOXTITLE,MB_ICONEXCLAMATION|MB_OK); return 1; } ResetObjects(); HWND hDialog = CreateDialog(g_sdata.hInstance,MAKEINTRESOURCE(DLG_MAIN),0,DialogProc); if (!hDialog) { MessageBox(0,DLGERROR,ERRBOXTITLE,MB_ICONEXCLAMATION|MB_OK); return 1; } haccel = LoadAccelerators(g_sdata.hInstance, MAKEINTRESOURCE(IDK_ACCEL)); while ((status=GetMessage(&msg,0,0,0))!=0) { if (status==-1) return -1; if (!IsDialogMessage(g_find.hwndFind, &msg)) { if (!TranslateAccelerator(hDialog,haccel,&msg)) { if (!IsDialogMessage(hDialog,&msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } } MemSafeFree(g_sdata.script); if (g_sdata.script_cmd_args) GlobalFree(g_sdata.script_cmd_args); if (g_sdata.sigint_event) CloseHandle(g_sdata.sigint_event); if (g_sdata.sigint_event_legacy) CloseHandle(g_sdata.sigint_event_legacy); FreeLibrary(hRichEditDLL); FinalizeUpdate(); return msg.wParam; }
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char *cmdParam, int cmdShow) { MSG msg; int status; HACCEL haccel; my_memset(&g_sdata,0,sizeof(NSCRIPTDATA)); my_memset(&g_resize,0,sizeof(NRESIZEDATA)); my_memset(&g_find,0,sizeof(NFINDREPLACE)); g_sdata.hInstance=GetModuleHandle(0); g_sdata.script_alloced=false; g_sdata.symbols = NULL; RestoreSymbols(); if (!InitBranding()) { MessageBox(0,NSISERROR,"Error",MB_ICONEXCLAMATION|MB_OK); return 1; } ResetObjects(); HWND hDialog = CreateDialog(g_sdata.hInstance,MAKEINTRESOURCE(DLG_MAIN),0,DialogProc); if (!hDialog) { MessageBox(0,DLGERROR,"Error",MB_ICONEXCLAMATION|MB_OK); return 1; } haccel = LoadAccelerators(g_sdata.hInstance, MAKEINTRESOURCE(IDK_ACCEL)); while ((status=GetMessage(&msg,0,0,0))!=0) { if (status==-1) return -1; if (!IsDialogMessage(g_find.hwndFind, &msg)) { if (!TranslateAccelerator(hDialog,haccel,&msg)) { if (!IsDialogMessage(hDialog,&msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } } if (g_sdata.script_alloced) GlobalFree(g_sdata.script); ExitProcess(msg.wParam); return msg.wParam; }