But the problem is that the focus is loss when the windos is created.
To solve it, add this line:
SetWindowPos(&wndTopMost,m_nWndLeft,m_nWndBottom - m_nWndSize -5,m_nWndWidth - 10,m_nWndSize,SWP_SHOWWINDOW|SWP_NOACTIVATE);
in the ::OnCreate function.
And add SWP_SHOWWINDOW|SWP_NOACTIVATE to all SetWindowPos of the code.
I use the same code but I write m_pTVDlg = new CTVDlg in my InitInstance and the CTVDlg inharits CDialog and creates modeless dialog from resource.
For some reason it hangs on the dialog creation.
It worked perfect when CTVDlg was created on the main thread.
Excellent work ! One issue though - when you select the Message->Pop menu item, the little window pops up but the main window loses focus. I'm writing an Instant Messenger program and tried your code out there - same thing happens.
From the point of view of a Messenger application, this issue is pretty serious because if the task bar window pops up while you are typing in a different window, the characters you typed are lost because the window loses focus for the duration of the task bar window's existence.
So how do you get it to not make the topmost window lose focus when the task bar window pops up ? I tried to change the &wndTopMost to some other value in the SetWindowPos () function calls, but that doesnt seem to work.
Also observed that once your task bar window has been instantiated, you can then manually click on another window and continue typing, and the task bar window will continue its expanding and contracting as normal.