Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program crashed when explorer.exe gets restarted. #100

Open
korolek13 opened this issue Dec 16, 2023 · 1 comment
Open

Program crashed when explorer.exe gets restarted. #100

korolek13 opened this issue Dec 16, 2023 · 1 comment

Comments

@korolek13
Copy link

I'm still experimenting with my workspace and sometimes I need to restart Windows Explorer to make some changes. But when I do that, the program crashes and I have to manually reopen it every time. It would be awesome if issue is solved, thanks.

winver information:

Version 23H2 (OS Build 22631.2861)

@HerMajestyDrMona
Copy link
Owner

HerMajestyDrMona commented Jul 24, 2024

Hmm, it doesn't seem to crash for me when restarting explorer. I only noticed that for some reasons the Tray icon disappeared when I restarted explorer, but the program was still running in the background.

It's possible that some window HWNDs are cached in the program (for optimization purposes and to prevent too frequent calls to the same FindWindow functions), and then some functions use the invalid window handle. However, it seems like I already update them for the mouse clicks:

if (!DetectedHWNDsForThisMouseClick) {
//Primary screen variables:
Update_Primary_Screen_Windows_HWNDSs();
//ver 1.6.1: MOVED BELOW
/*if (UseFixForBugAfterSleepMode) {
if (PrimaryScreen.hWndMSTaskSwWClass) {
if (Fix_Taskbar_Size_Bug(PrimaryScreen.hWndMSTaskSwWClass)) {
//Fixed. Ignore this loop to get potentially new HWND and RECTs.
DetectedHWNDsForThisMouseClick = false;//IMPORTANT ver. 1.9.1 to fix program crash after the sleep mode.
AdvancedSleep();
continue;
}
}
}*/
Array_Windows_by_Screen.clear();
//Before version 1.9.1 this array could be empty after the sleep mode bug fix, causing program crashes.
Array_Windows_by_Screen.push_back(PrimaryScreen);
//Shell_SecondaryTrayWnd:
EnumWindows(enumWindowCallback_SecondaryTrayWnd, NULL);
hDesktop = GetDesktopWindow();
GetWindowRect(hDesktop, &desktop);
ShowDesktopStartPosition = desktop.right - DefaultShowDesktopButtonWidth;
DetectedHWNDsForThisMouseClick = true;//Moved from top to bottom.
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants