Hi Rolf,
Sorry for my delayed reply.
You're in the right direction on attempting to set the desktop the parent
of the your form to embed your form as a part of the desktop.
I use spy++ to capture the desktop window and found that it is comprised of
3 sub windows. They're SysListView32, SHELL_DefView and Progman from
outside to inside. You could set any of these 3 sub window as the parent
window of your form.
The only difference is that if you set the SysListView32 as the owner, when
your form is minimized, it still stays on the desktop. On the contrary, if
you set the SHELL_DefView or Progman as the owner, when you minimize your
form, it becomes invisible. I suggest that you choose the SysListView32 as
the parent window.
To set a window as the parent window of another window, we could use the
Win32API -- SetParent.
The following is a sample.
using System.Runtime.InteropServices;
public partial class Form1 : Form
{
[DllImport("user32.dll")]
static extern private IntPtr FindWindow(string lpClassName,
string lpWindowName);
[DllImport("user32.dll")]
static extern private IntPtr GetWindow(IntPtr hWnd, int uCmd);
[DllImport("user32.dll")]
static extern private IntPtr SetParent(IntPtr hWndChild, IntPtr
hWndNewParent);
const int GW_CHILD = 5;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
IntPtr progmanhwnd = FindWindow("Progman", null);
IntPtr shellhwnd = GetWindow(progmanhwnd, GW_CHILD);
IntPtr folderhwnd = GetWindow(shellhwnd, GW_CHILD);
SetParent(this.Handle, folderhwnd);
}
}
Please try my suggestion and let me know the result.
Sincerely,
Linda Liu
Microsoft Online Community Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Rolf Welskes - 29 Jan 2007 13:12 GMT
Hello,
thank your for your informations.
It works fine.
Thank you again and best regards
Rolf Welskes
> Hi Rolf,
>
[quoted text clipped - 59 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.