X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=gui.cpp;h=83f216593ece133e8550c70a786027d55e86e0a2;hb=8561a216b764d928364f432a590bead3547e1497;hp=5041acdc89a9e692bd5adb28ee70f79b37bd440f;hpb=167b3e74003ed8f2b61bda7037f31447c488c29b;p=nssm.git diff --git a/gui.cpp b/gui.cpp index 5041acd..83f2165 100644 --- a/gui.cpp +++ b/gui.cpp @@ -6,7 +6,7 @@ int nssm_gui(int resource, char *name) { /* Create window */ HWND dlg = CreateDialog(0, MAKEINTRESOURCE(resource), 0, install_dlg); if (! dlg) { - snprintf(blurb, sizeof(blurb), "CreateDialog() failed with error code %d", GetLastError()); + _snprintf(blurb, sizeof(blurb), "CreateDialog() failed with error code %d", GetLastError()); MessageBox(0, blurb, NSSM, MB_OK); return 1; } @@ -35,7 +35,7 @@ int nssm_gui(int resource, char *name) { DispatchMessage(&message); } - return message.wParam; + return (int) message.wParam; } void centre_window(HWND window) { @@ -58,7 +58,7 @@ void centre_window(HWND window) { /* Centre window */ x = (desktop_size.right - size.right) / 2; y = (desktop_size.bottom - size.bottom) / 2; - MoveWindow(window, x, y, size.right, size.bottom, 0); + MoveWindow(window, x, y, size.right - size.left, size.bottom - size.top, 0); } /* Install the service */ @@ -67,7 +67,7 @@ int install(HWND window) { /* Check parameters in the window */ char name[STRING_SIZE]; - char exe[MAX_PATH]; + char exe[EXE_LENGTH]; char flags[STRING_SIZE]; /* Get service name */ @@ -133,7 +133,7 @@ int remove(HWND window) { /* Confirm */ char blurb[MAX_PATH]; - if (snprintf(blurb, sizeof(blurb), "Remove the \"%s\" service?", name) < 0) { + if (_snprintf(blurb, sizeof(blurb), "Remove the \"%s\" service?", name) < 0) { if (MessageBox(0, "Remove the service?", NSSM, MB_YESNO) != IDYES) return 0; } else if (MessageBox(0, blurb, NSSM, MB_YESNO) != IDYES) return 0; @@ -179,7 +179,7 @@ void browse(HWND window) { } /* Install/remove dialogue callback */ -int CALLBACK install_dlg(HWND window, UINT message, WPARAM w, LPARAM l) { +INT_PTR CALLBACK install_dlg(HWND window, UINT message, WPARAM w, LPARAM l) { switch (message) { /* Creating the dialogue */ case WM_INITDIALOG: