c# - "pin to desktop" in Win 7, XP compatible -


I can do to get immunity) against the pin "effect (ie" Show Desktop "command on the" Desktop 7 Using the FindWindow + Setter approach, or any other way that will work in XP too? I know that I could make a gadget, but I would like backwards compatibility with XP, where I code is fine:

  IntPtr hWnd = FindWindow (NULL, "Untitled - Notepad "); IntPtr hDesktop = FindWindow ("ProgMan", "Program Manager"); Setpants (hwnd, hdktop); In my WPF app, I was able to solve it by using a timer, it is working. XP and Win 7 both in  

  Public Manvindo () {InitializeComponent (); // There is some timer for every 1 second dispatcher detector. Shadowcoptimer = new dispatch timer (); DetectShowDesktopTimer.Tick + = new event handler (detectShowDesktopTimer_Tick); DetectShowDesktopTimer.Interval = new timezone (0, 0, 1); DetectShowDesktopTimer.Start (); } # Delaimport ( "user32.dll")] of immunizing #region support private static extern IntPtr GetForegroundWindow (against); [DllImport ("user32.dll")] Public static extern bool SetForegroundWindow (IntPtr hWnd); [DllImport ( "user32.dll")] private static extern c GetWindowText (IntPtr hWnd, StringBuilder text, int count); Private string gateway (intuit handle) {int chars = 256; StringBuilder Buff = New StringBuilder (character); If (GetWindowText (handle, buff, character) gt 1) return buff. Toasting (); And return string Empty; } # Ondriyn private Wuid Ditektsovdesktoptimrtikt (object sender, Iventaarjis e) {Intiprtr Foray = Getmorgroundvando (); If (string.IsNullOrWhiteSpace (GetWindowText (fore))) ShowDesktopDetected (); } Private void ShowDesktopDetected () {WindowInteropHelper wndHelper = new WindowInteropHelper (this); SetForegroundWindow (wndHelper.Handle); }  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -