A confirmation message box is now shown on hard reset from the manager and emulator shutdowns are now notified to the manager.

This commit is contained in:
OBattler
2019-11-01 03:08:58 +01:00
parent 90053f15ff
commit f862928f0c
2 changed files with 18 additions and 6 deletions

View File

@@ -8,15 +8,15 @@
*
* Platform support defintions for Win32.
*
* Version: @(#)win.h 1.0.25 2019/02/11
* Version: @(#)win.h 1.0.26 2019/11/01
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2008-2019 Sarah Walker.
* Copyright 2016-2019 Miran Grca.
* Copyright 2017-2019 Fred N. van Kempen.
*/
#ifndef PLAT_WIN_H
# define PLAT_WIN_H
@@ -57,6 +57,8 @@
#define WM_SENDSTATUS 0x8895
/* Settings status: WPARAM = 1 for open, 0 for closed. */
#define WM_SENDSSTATUS 0x8896
/* Emulator shut down. */
#define WM_SHUTDOWN_DONE 0x8897
#ifdef USE_VNC
#ifdef USE_D2D

View File

@@ -8,7 +8,7 @@
*
* user Interface module for WinAPI on Windows.
*
* Version: @(#)win_ui.c 1.0.40 2019/10/31
* Version: @(#)win_ui.c 1.0.41 2019/11/01
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -309,6 +309,8 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case IDM_ACTION_EXIT:
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122);
if (i == 0) {
if (source_hwnd)
PostMessage((HWND) (uintptr_t) source_hwnd, WM_SHUTDOWN_DONE, (WPARAM) 0, (LPARAM) hwndMain);
UnhookWindowsHookEx(hKeyboardHook);
KillTimer(hwnd, TIMER_1SEC);
PostQuitMessage(0);
@@ -671,6 +673,8 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_CLOSE:
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122);
if (i == 0) {
if (source_hwnd)
PostMessage((HWND) (uintptr_t) source_hwnd, WM_SHUTDOWN_DONE, (WPARAM) 0, (LPARAM) hwndMain);
UnhookWindowsHookEx(hKeyboardHook);
KillTimer(hwnd, TIMER_1SEC);
PostQuitMessage(0);
@@ -678,6 +682,8 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_DESTROY:
if (source_hwnd)
PostMessage((HWND) (uintptr_t) source_hwnd, WM_SHUTDOWN_DONE, (WPARAM) 0, (LPARAM) hwndMain);
UnhookWindowsHookEx(hKeyboardHook);
KillTimer(hwnd, TIMER_1SEC);
PostQuitMessage(0);
@@ -693,12 +699,16 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_HARDRESET:
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2121);
if (i == 0)
pc_reset(1);
break;
case WM_SHUTDOWN:
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122);
if (i == 0) {
if (source_hwnd)
PostMessage((HWND) (uintptr_t) source_hwnd, WM_SHUTDOWN_DONE, (WPARAM) 0, (LPARAM) hwndMain);
UnhookWindowsHookEx(hKeyboardHook);
KillTimer(hwnd, TIMER_1SEC);
PostQuitMessage(0);