Hi all. Lets say I have a plain window in C#. It has no border styles so it cannot be moved or resized etc. How would i position that window so it appears at the same level as the desktop or one above?
Like a widget or a rainmeter skin. Any ideas?
Hi all. Lets say I have a plain window in C#. It has no border styles so it cannot be moved or resized etc. How would i position that window so it appears at the same level as the desktop or one above?
Like a widget or a rainmeter skin. Any ideas?
If I understand you correctly and you want to draw on the desktop, basically, then this might help: http://www.neowin.net/forum/lofiversion/index.php/t293883.html
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr FindWindow(
[MarshalAs(UnmanagedType.LPTStr)] string lpClassName,
[MarshalAs(UnmanagedType.LPTStr)] string lpWindowName);
[DllImport("user32.dll")]
public static extern IntPtr SetParent(
IntPtr hWndChild, // handle to window
IntPtr hWndNewParent // new parent window
);
IntPtr hwndf = this.Handle;
IntPtr hwndParent = FindWindow("ProgMan", null);
SetParent(hwndf,hwndParent);
this.TopMost = false;
That would reparent your form as a child window of the desktop itself.
After reading the code some more times I'm not sure why they use FindWindow() looking for "ProgMan" instead of using
[DllImport("user32.dll")]
static extern IntPtr GetDesktopWindow();
but I didn't give it a try myself so far.