Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Cannot reboot while GUI_VisualStudio.exe is runnin
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Cannot reboot while GUI_VisualStudio.exe is runnin

 Post Reply Post Reply
Author
Message
calvi View Drop Down
Groupie
Groupie


Joined: 20 March 2004
Location: United Kingdom
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote calvi Quote  Post ReplyReply Direct Link To This Post Topic: Cannot reboot while GUI_VisualStudio.exe is runnin
    Posted: 28 August 2021 at 10:49am
GUI_VisualStudio.exe built with v19.3.0 using VS2019 16.11.2 prevents Windows 10, 21H1 from rebooting and locks itself up.  This can be fixed by editing XTPHookManager.cpp and inserting the following code at the start of CXTPHookManager::HookWndProc:

    if (message == WM_ENDSESSION)
        return 0;

A variation of this, seen in my own program, is that the following code later in that function results in an out of memory exception which also locks up:

        pSink = XTPHookManager()->Lookup(hWnd);

That fix cures both problems.
Back to Top
calvi View Drop Down
Groupie
Groupie


Joined: 20 March 2004
Location: United Kingdom
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote calvi Quote  Post ReplyReply Direct Link To This Post Posted: 21 September 2021 at 12:09pm
This bug is also present in v20.1.0.
Back to Top
agontarenko View Drop Down
Admin Group
Admin Group


Joined: 25 March 2016
Status: Offline
Points: 299
Post Options Post Options   Thanks (0) Thanks(0)   Quote agontarenko Quote  Post ReplyReply Direct Link To This Post Posted: 13 October 2021 at 7:46am
Hello,

During normal application closing called CXTPWinApp::ExitInstance() function.
All global codejock library variables should be removed in XTPShutdown() function that called from CXTPWinApp::ExitInstance().
Before XTPShutdown() call all dialogs or frames windows should be closed. Global variables already not used and can be deleted.


During application closing with CFrameWnd::OnEndSession() function
system will called pApp->ExitInstance() function that remove all global variables that currently used in CFrameWnd derived class, after this you get problem that your discribed.



This document discribed Restart Manager API https://docs.microsoft.com/en-us/windows/win32/rstmgr/guidelines-for-applications. I think you need to get WM_CLOSE message during shutdown and application will be closed without problem.

Regards,
Artem Gontarenko
Back to Top
calvi View Drop Down
Groupie
Groupie


Joined: 20 March 2004
Location: United Kingdom
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote calvi Quote  Post ReplyReply Direct Link To This Post Posted: 13 October 2021 at 8:12am
Thanks for your suggestion, but GUI_VisualStudio is not my code!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.