0

I created a library which lets you move any window behind the desktop icons using the user32.dll, but the problem is that the window doesn't react neither to clicks or key presses (even KeyboardDevice didn't seem to capture anything)'

One thing to note though is that after I make any window run on that wallpaper layer, it disappears from the task bar.

This is the code:

    public static void MoveBehindIcons(IntPtr windowHandle)
    {
      IntPtr window = W32.FindWindow("Progman", (string) null);
      IntPtr result = IntPtr.Zero;
      int num1 = 1324;
      IntPtr wParam = new IntPtr(0);
      IntPtr zero = IntPtr.Zero;
      int num2 = 0;
      int num3 = 1000;
      W32.SendMessageTimeout(window, (uint) num1, wParam, zero, (W32.SendMessageTimeoutFlags) num2, (uint) num3, out result);
      IntPtr workerw = IntPtr.Zero;
      W32.EnumWindows((W32.EnumWindowsProc) ((tophandle, topparamhandle) =>
      {
        if (W32.FindWindowEx(tophandle, IntPtr.Zero, "SHELLDLL_DefView", IntPtr.Zero) != IntPtr.Zero)
          workerw = W32.FindWindowEx(IntPtr.Zero, tophandle, "WorkerW", IntPtr.Zero);
        return true;
      }), IntPtr.Zero);
      W32.SetParent(windowHandle, workerw);
    }

the W32 class: https://pastebin.com/Tw72Lbw6

WallpaperEngine can do it somehow..

Is it possible to make it work?

Tom Lenc
  • 765
  • 1
  • 17
  • 41
  • Could you at least explain why you downvoted whoever did please? – Tom Lenc May 25 '18 at 10:37
  • See msdn posting : https://social.msdn.microsoft.com/Forums/en-US/bfc75b57-df16-48c6-92af-ea0a34f540ae/how-to-get-the-handle-of-a-window-that-i-click?forum=csharplanguage – jdweng May 25 '18 at 10:43
  • Hi, I am reviewing your post. The SO community values when you show your own efforts, so you might want to add some code. Please check here on how to ask good questions: https://stackoverflow.com/help/how-to-ask – rainer May 25 '18 at 11:30
  • How can we give you advice on what we can't see. The code isn't here. – David Heffernan May 25 '18 at 13:12
  • @DavidHeffernan what do you mean I provided a link to it – Tom Lenc May 25 '18 at 13:57
  • 1
    @TomLenc: Yeah, that's not **"here"**, and it's not the minimum code necessary to see the problem. Please see https://stackoverflow.com/help/mcve and [Something in my web site or project doesn't work. Can I just paste a link to it?](https://meta.stackoverflow.com/q/254428/103167) – Ben Voigt May 25 '18 at 14:24
  • 2
    A major problem with code links is that someone viewing the same question in the future won't see the same code, so the question and answers won't make sense. Remember that Stack Overflow is an encyclopedia of Q&A, not a help service. We want answers to help other programmers who have similar problems. – Ben Voigt May 25 '18 at 14:26
  • @BenVoigt that's true although the code is enormously long because of all the `user32.dll` bindings – Tom Lenc May 25 '18 at 14:31
  • @Tom You cut it down to a [mcve] – David Heffernan May 26 '18 at 06:31
  • 1
    @DavidHeffernan I already did – Tom Lenc May 26 '18 at 10:30
  • Nope. You did not. – David Heffernan May 26 '18 at 11:01
  • @DavidHeffernan I don't know what else to provide. As I've said, whatever window is sent to that wallpaper layer doesn't receive click or keypress events. – Tom Lenc May 26 '18 at 11:12

0 Answers0