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

Added support for Windows 10 by filtering out cloaked apps #55

Merged
merged 1 commit into from
Aug 6, 2019

Conversation

vhanla
Copy link
Contributor

@vhanla vhanla commented Aug 2, 2019

This fixes issue #36

It just calls DwmGetWindowAttribute(hWnd, DWMWA_CLOAKED, out int cloaked, sizeof(int)) and if it is a visible Windows App it will return in cloaked the value 0 otherwise it means the app is cloaked(aka hidden) as https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute mentions.

It seems that newline format made the diff unusable, so here are the modifications:

//line 54
 [DllImport("dwmapi.dll")]
        private static extern int DwmGetWindowAttribute(IntPtr hWnd, int dwAttribute, out int pvAttribute, int cbAttribute);
//line 79
		    //if (className == "ApplicationFrameWindow")
			   // InspectWindows10AppWindow(hWnd, windows, className);
		    //else
			    InspectNormalWindow(hWnd, currentProcessId, windows, className);
	    }

		private static void InspectNormalWindow(IntPtr hWnd, int currentProcessId, ICollection<IWindowEntry> windows, string className)
		{
            if (className == "ApplicationFrameWindow")
            {
                // check if windows is not cloaked
                const int DWMWA_CLOAKED = 14;
                DwmGetWindowAttribute(hWnd, DWMWA_CLOAKED, out int cloaked, sizeof(int));
                if (cloaked != 0) return;
            }
// continues, and no more modifications was done

@christianrondeau christianrondeau merged commit a02ccd9 into christianrondeau:master Aug 6, 2019
@christianrondeau
Copy link
Owner

Thanks a lot! Merged and published!

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

Successfully merging this pull request may close these issues.

2 participants