altdrag icon indicating copy to clipboard operation
altdrag copied to clipboard

Crashes on Windows 10 after system woke up from sleep

Open keighrim opened this issue 9 years ago • 32 comments

The app stops working after system sleep. App icon in tray loses its white border and becomes not responding at all.

As a workaround, killing the task and re-run works.

keighrim avatar Jul 31 '15 13:07 keighrim

I could not reproduce this. Does it happen every time?

Anyone else have this problem?

stefansundin avatar Aug 04 '15 15:08 stefansundin

I actually installed Win 10 on my second laptop last night, and found this issue doesn't happen on that machine. I'm trying to find what kind of conflict in the first device is causing this.

I'm closing this for now I'll open another issue with more specifics, when I figure out what's the problem.

keighrim avatar Aug 04 '15 15:08 keighrim

I can confirm this still happens more often than not after the computer resumes sleep, on a laptop too.

joserebelo avatar Aug 18 '15 13:08 joserebelo

Not sure if this is related (I very strongly suspect it may be), but windows 8.1 and windows 10 have some odd display re-sizing issues on sleep. I'm using 2x4k monitors and it constantly re-sizes open windows (e.g. chrome, explorer, etc.) when the monitors go to sleep. It has to do with a simulated display setting in the registry (specifically a mismatch in the simulated resolution when no monitor is detected I believe).

To reproduce the issue, you have to have a different resolution on the simulated desktop space (and it seems to me like changing the simulated resolutions have fixed the issue on my computer).

The relevant keys are under : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration

There are a couple of keys prefixed "SIMULATED..." and the relevant entries are a couple of other entries (00 and another nested 00). The names of the relevant keys are:

(in the first 00) PrimSurfSize.cx PrimSurfSize.cy

(in the nested 00) ActiveSize.cx ActiveSize.cy

if you change the keys to match your specific desktop resolution it seems to fix the issue. I'm not an expert in windows internals, but I'm guessing this is a failure case that @stefansundin hasn't been able to reproduce because he doesn't use a monitor that uses HDMI or DisplayPort (which are the only displays on which I've been able to reproduce the issue, any earlier connectors seem to function fine). I'm not sure if the SIMULATED displays are ever used absent HDMI/DisplayPort (again, this isn't my area of expertise!).

sethbc avatar Sep 18 '15 00:09 sethbc

Just wanted to briefly update - this doesn't seem to perfectly fix the issue, but it seems to occur much less frequently.

sethbc avatar Sep 20 '15 01:09 sethbc

My computer doesn't have those keys in the registry, but the issue also happens when i connect a new screen, so it seems to indeed be related to the display settings.

joserebelo avatar Oct 23 '15 15:10 joserebelo

I'm also having this issue. I'm on a laptop with an external monitor. Along with the crash I see other issues (unrelated to AltDrag) when the monitors turn off like my windows all getting moved to the top left of my screen.

Is there a crashlog or any other information I can provide?

Rob-ot avatar Oct 23 '15 21:10 Rob-ot

AltDrag does not have a crashlog, unfortunately.

Do the DPI scaling change around the same time AltDrag is crashing?

stefansundin avatar Oct 23 '15 21:10 stefansundin

It might yeah, my primary screen (external monitor) is a normal screen and the laptop has a retina screen, so when it's turning off screens it may report one value vs the other.

Rob-ot avatar Oct 23 '15 21:10 Rob-ot

With only the laptop monitor, if I change the dpi from 100% to 125% AltDrag will crash, yes.

joserebelo avatar Oct 23 '15 22:10 joserebelo

I was able to resolve this issue by setting DPI using control panel (not through windows settings universal app)

keighrim avatar Oct 28 '15 04:10 keighrim

Can confirm, the dpi was set to 125% in the control panel, even though it was set to 100% in the universal app. This solved the AltDrag issues, plus some mouse/keyboard problems I had when resuming from sleep and connecting displays (I think were related to AutoHotKey, having the same cause).

joserebelo avatar Nov 01 '15 00:11 joserebelo

I'm still having this issue with AltDrag v1.1. I'm using a Windows 10 laptop with two attached 1920x1200 screens (one in landscape orientation, one in portrait mode). DPI scaling is set to 100% (Change the size of text, apps, and other items). Any update on the issue?

tuok avatar Jan 13 '16 13:01 tuok

@tuok From your description, I think you have set DPI in the universal settings app (which is triggered by pressing Win+I or select "All settings" from notification center. Why don't you try setting DPI using control panel (right click on start -> "Control panel" -> "Display" -> "set a custom scaling level" (in the middle of the text in upper center) ).

I'm not sure if it does matter to sync both DPI, but I have set them (from universal app and control panell) synced to 100%, and the issue has gone ever since.

keighrim avatar Jan 13 '16 13:01 keighrim

@keighrim Thanks for your suggestion, but unfortunately custom scaling level in Control Panel was already set to 100%.

I just started to investigate the issue, so I'm not sure when and how the problem exactly appears. I tried to reconnect both external monitors, but it didn't make any difference, at least for now.

tuok avatar Jan 13 '16 13:01 tuok

I'm also having this problem. I suspect my issue is related to sethbc's. I have a high resolution screen (3840 x 2160) connected by DisplayPort, and Windows often does weird resizing & position of windows when the computer returns from sleep.

I tried the registry setttings but it doesn't resolve the issue, unfortunately. Windows still get re-positioned and resized (not AltDrag's problem, obviously), and AltDrag stops working.

SgtGrumbles avatar Feb 19 '16 03:02 SgtGrumbles

I have the problem - for several weeks, I think it also happens after screen lock - and I definitely see it on resume, though I frequently connect/disconnect mini displayport.

As a work around, I do taskkill as admin, then restart it manually as admin... really hoping you're able to figure it out soon.

nevion avatar Jun 30 '16 22:06 nevion

I have this issue every day now for weeks and it's getting really annoying. I have to go in the task manager and kill altgrab and then restart it every time the computer goes into power saving.

Any news on this issue?

Brog33 avatar Jul 28 '16 08:07 Brog33

I get this issue regularly just when my monitor configuration changes (but it's not always easily reproducible). I'm on Dell Precision 5510 with a Dell USB-C WD15 dock. Simply unplugging the thunderbolt 3 (USB-C) and plugging back in will cause it to gray out. I do have a 4K display on my laptop and sometimes I wonder if the temporary flashing into 4K resolution (scaled up) back down and etc (even on the main laptop monitor as I don't utilize full resolution) has something to do with it.

It's easy to tell if it crashed too by looking at the icon. I tried to get it to crash with no luck, so I'll post screenshots later when it happens again!

patricknelson avatar Dec 01 '16 20:12 patricknelson

Ok, I was finally able to reproduce it consistently. I believe I have traced it down scaling in Windows 10. See the Settings area (Windows + I), then go to System -> Display and under "Change the size of text, apps and other items". If you adjust it that, AltDrag will instantly crash 100% of the time.

This has become a common enough issue for me to create a quick batch script for it to restart AltDrag:

@echo off
taskkill /F /T /IM AltDrag.exe
start "" "C:\path\to\AltDrag.exe"

Screen capture: 2016-12-02_14-40-30

patricknelson avatar Dec 02 '16 22:12 patricknelson

I still experience this same issue when waking from sleep (generally after attaching or detaching from other monitors). Have to kill the AltDrag process and manually restart it.

ahernsean avatar Oct 26 '18 19:10 ahernsean

For reference, still experiencing this on Win10 with AltDrag version 1.1. Script by @patricknelson works well to resolve, embedded as AHK hotkey. Still, AltDrag remains one of the best little tools I've come across - thanks @stefansundin . :-)

jgraden avatar Mar 26 '19 12:03 jgraden

For reference, still experiencing this on Win10 with AltDrag version 1.1. Script by @patricknelson works well to resolve, embedded as AHK hotkey. Still, AltDrag remains one of the best little tools I've come across - thanks @stefansundin . :-)

Can you share your AHK script that launches this? Do you mean you set it up on an actual hotkey combo (like win+alt+A or something like that?) Right now I have just a "restart_altdrag.bat" file on my desktop with @patricknelson's script, wondering if there's a way to automate it upon the laptop waking up.

jdnixx avatar Nov 24 '19 23:11 jdnixx

wondering if there's a way to automate it upon the laptop waking up.

@jDally987 you can create a "Scheduled Task" that activates when resuming from sleep: https://superuser.com/a/149924

garoto avatar Nov 25 '19 02:11 garoto

Just FYI, I'm hitting this issue as well. If I have my external display connected, and walk away from my laptop for long enough for the monitor to turn off (and hence for the desktop to lock), then upon returning/unlocking, AltDrag is non-functional and the system tray icon is black.
Killing & restarting AltDrag when it occurs seems to be my only choice at the moment.

Remington012 avatar Mar 17 '20 19:03 Remington012

I fixed this problem on my fork. https://github.com/RamonUnch/AltDrag The problem was related to tray icon: In some cases when resuming from sleep mode under windows 10 DPI scaling changes, ad when it changes, AltDrag recieves the WM_TASKBARCREATED message. AltDrag in this case will try in an infinite loop to restore his tray icon. Because the tray icon is still there it is not possible and AltDrag is stuck. The fix is easy, you just need to modify the loop in UpdateTray() function.

@pablospe @warnerAWESOMEmoore and @benley This should also fix your issue #107 with screen resolution change.

RamonUnch avatar Jan 17 '21 14:01 RamonUnch

Great! Thanks a lot! Is there a Pull Request of your code for this repo? I would say many people won't know about your independent changes, and it would be nice to merge your great changes to the main repo.

pablospe avatar Feb 08 '21 16:02 pablospe

The code is very heavily modified and completely refactored. I made a separate repositorry Stefan Sundin is really no more working on this project, not even to the point of merging any pull request anyway. Look at celynw pull request about fixing Win10 invisible border bug. dsjstc proposed Stefan to push my fork on the readme.md or the official page but, I think Stefan has really no more time for this project.

RamonUnch avatar Feb 08 '21 17:02 RamonUnch

That's understandable. But it would be good if Stefan could make that statement and have his point to yours as the successor.


From: RamonUnch [email protected] Sent: Monday, February 8, 2021 12:51 PM To: stefansundin/altdrag [email protected] Cc: Sean Ahern [email protected]; Comment [email protected] Subject: Re: [stefansundin/altdrag] Crashes on Windows 10 after system woke up from sleep (#34)

[External Sender]

The code is very heavily modified and completely refactored. I made a separate repositorry Stefan Sundin is really no more working on this project, not even to the point of merging any pull request anyway. Look at celynw pull request about fixing Win10 invisible border bug. dsjstc proposed Stefan to push my fork on the readme.md or the official page but, I think Stefan has really no more time for this project.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fstefansundin%2Faltdrag%2Fissues%2F34%23issuecomment-775326374&data=04%7C01%7Csean.ahern%40ansys.com%7C83b59e0f7aac43d29af108d8cc5a2597%7C34c6ce6715b84eff80e952da8be89706%7C0%7C0%7C637484034844154638%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=PBr8kvD4sKSaYAqw3T5CetqDFfq3FTOkgEveFyf3xvA%3D&reserved=0, or unsubscribehttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAMSVFE54ZJ4AQSMKRVYCW3S6AQBTANCNFSM4BMN5MJQ&data=04%7C01%7Csean.ahern%40ansys.com%7C83b59e0f7aac43d29af108d8cc5a2597%7C34c6ce6715b84eff80e952da8be89706%7C0%7C0%7C637484034844154638%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=pVgqm1CfILI6ilbg1LYSPW48o4QUBodsBiESTh0BsBU%3D&reserved=0.

ahernsean avatar Feb 08 '21 18:02 ahernsean

If Stefan has abandoned AltDrag he could transfer the repo to Ramon or perhaps add a link to Ramon's version.

FSund avatar Feb 08 '21 18:02 FSund

Maybe an AltDrag organization could be created and all the contributors can help to move this project forward. Also people for reviewing code, etc., so it is not only one. So the repo would be something like: github.com/altdrag/altdrag (and the contributors to have access to it)

pablospe avatar Feb 08 '21 18:02 pablospe

If anyone wants to participate to my fork, he is welcome to submit pull requests. I always worked alone and am not a professional programmer, I am not sure I could handle several contributors. With my job, and the current situation, the time I can allocate to the project is very random. I took this project because the original AltDrag was not usable for me and yet it implemented a feature that is mandatory. Originally I just fixed the code for myself, then I made it public because I saw really no one would work on this again unless I do it myself. In general will try to focus on bug fixing instead of new features, because I do not need new features.

RamonUnch avatar Feb 09 '21 11:02 RamonUnch