If I cancel the shutdown, does the IME undetermined string disappear?

Asked 2 years ago, Updated 2 years ago, 99 views

You can block the shutdown by calling ShutdownBlockReasonCreate() and returning FALSE to WM_QUERYENDSESSION, but when you cancel the shutdown, the IME undetermined string no longer appears in the blocked application.

Enter a description of the image here

I didn't reproduce it on the Win7 machine, so I think the specification changed at 8(.1).

If I restart the application, it will be fixed, but is there a way to avoid this behavior?

// Sample code used for screenshots
// Changed from VisualStudio's Win32 Project as follows:
LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch(message)
    {
    caseWM_CREATE:
        CreateWindow(
            _T("EDIT"), _T("hoge"),
            WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT,
            0,0,600,400,hWnd,NULL,hInst,NULL
        );
        break;
    case WM_QUERYENDSESSION:
        ShutdownBlockReasonCreate(hWnd,_T("test"));
        return FALSE;
    caseWM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

c winapi windows-8

2022-09-30 17:04

1 Answers

If this only happens with the software, it may not matter, so please refer to it.

I haven't checked it yet, but I think some IME-related process might have ended earlier.

SetProcessShutdownParameters to prioritize shutdown notifications

However, if the process is similarly prioritized, you cannot guarantee that you will receive notifications first.


2022-09-30 17:04

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.