I also needed to solve a similar problem recently. Abel's answer set me in the right direction. Here is a complete example of how I did this by changing the normal window to a message-only window:
class MessageWindow : Form {
[DllImport("user32.dll")]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
public MessageWindow() {
var accessHandle = this.Handle;
}
protected override void OnHandleCreated(EventArgs e) {
base.OnHandleCreated(e);
ChangeToMessageOnlyWindow();
}
private void ChangeToMessageOnlyWindow() {
IntPtr HWND_MESSAGE = new IntPtr(-3);
SetParent(this.Handle, HWND_MESSAGE);
}
protected override void WndProc(ref Message m) {
}
}
: , Handle, OnHandleCreated . , , - , .
, : Windows?