Skip to content

Instantly share code, notes, and snippets.

@neokril
Created December 19, 2013 08:15
Show Gist options
  • Save neokril/8035995 to your computer and use it in GitHub Desktop.
Save neokril/8035995 to your computer and use it in GitHub Desktop.
Little application for enabling Windows option "Show window contents while dragging". This app can be used as a fix for Citrix client incorrect behavior - it switches off this option from time to time. I tried this solution: http://aaronwalrath.wordpress.com/2010/12/05/fix-for-citrix-xenapp-published-apps-disabling-windows-visual-effects/ but it…
#include <windows.h>
#include <tchar.h>
#include <cstdio>
#pragma comment(lib, "user32.lib")
int _tmain(int argc, _TCHAR* argv[])
{
BOOL enabled;
SystemParametersInfo(SPI_GETDRAGFULLWINDOWS,
NULL, &enabled, 0);
printf("Current 'dragfullwindow' option status: %d\n", enabled);
if (!enabled)
{
SystemParametersInfo(SPI_SETDRAGFULLWINDOWS,
TRUE,
NULL,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
}
return 0;
}
@Woolbox
Copy link

Woolbox commented May 8, 2015

Thank you! Took me ages to figure what actually disabled this. Then I found your code via http://stackoverflow.com/questions/1114525/update-desktop-show-window-contents-while-dragging-setting-programatically. I compiled it, ran it and it works just as advertised.

One suggestion for improvement would be to leave the application running, sitting in the systray and periodically check and re-enable the setting. Right now I use a repeating scheduled task to do this, which is not so pretty.

Unfortunately, I have no experience with C++ so I wouldn't know how to implement this.

@EMarshal
Copy link

EMarshal commented Jun 3, 2015

I actually wrote a .NET systray version of this to try and detect when the "show window contents while dragging" is changed and change it back. Unfortunately, while it's possible to detect when the setting is changed via the Windows UI, the Citrix client manages to change it completely silently, so the only way for it to work is to simply toggle the setting on some schedule... and scheduling a repeated task is exactly what the task scheduler is designed for, so there's not much reason to re-implement this while requiring the program to be open all the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment