Position on Desktop

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.

Advertisement

Leave a Comment

No comments yet.

Comments RSS TrackBack Identifier URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.