My application is intended to work almost entirely through a Windows 7 taskbar item with the use of thumbnails and jump lists. I know I can easily create a Form
and simply hide it, but this seems like overkill. Plus, I'd like to toy around with NativeWindow
as much as possible, because I've never used it before.
Essentially, I have a class called RootWindow
that derives from NativeWindow
that will handle hotkeys and hopefully everything else. I don't need a visible window at all, but simply something to process window messages and provide a taskbar item that I can attach thumbnails and jump lists to.
Is there some kind of special CreateParams
option I need to pass to CreateHandle
? Or am I out of luck?
EDIT: Well, it was easier than I thought it would be, although it's not exactly what I want. Once I passed the NativeWindow
's handle to the ShowWindow
API, the taskbar item appeared. However, it also shows a window in the upper left corner of the screen. Is there some way to get rid of that window while still showing the taskbar item?
public class RootWindow : NativeWindow {
public const int SW_SHOWNOACTIVATE = 4;
[DllImport("User32.dll")]
private static extern int ShowWindow(IntPtr hWnd, short cmdShow);
public RootWindow() {
CreateHandle(new CreateParams());
ShowWindow(this.Handle, SW_SHOWNOACTIVATE);
}
}