I am writing a program that displays / hides the window of some target application. I tested it before and noticed something strange. If I run the target application as an administrator (right-click-> Properties, tab "Compatibility", "Run this program as administrator"), it does not work.
To demonstrate, I wrote a simple graphical application called "TargetApplication", and then I wrote the following code to verify that this application is shown / hidden:
class Program { static void Main(string[] args) { IntPtr windowPtr = FindWindow(null, "TargetApplication"); ShowWindow(windowPtr, 0);
If I run a windowed application without administrator privileges, it does not work.
Could anyone check this out for me? I downloaded the .exe file for both applications:
Download TestShowWindow
All you have to do is download them and run TestApplication.exe and then run TestShowWindow.exe. You will find that by changing TestApplication.exe to run as administrator, ShowWindow no longer works.
Of course, if you do not trust the download of my materials, you can always compile my code and test it on any target application in Windows so that you can change the compatibility mode.
PS I'm not sure if that matters, but I'm running Windows 8 Pro. 64 bit
source share