Everytime I create a Tree-view it shows up fine. I can put items in it very easily. When I add a WM_COMMAND message it stops working. No items are visible. What could be wrong?
Printable View
Everytime I create a Tree-view it shows up fine. I can put items in it very easily. When I add a WM_COMMAND message it stops working. No items are visible. What could be wrong?
When something is added it sends a WM_COMMAND. So, when the WM_COMMAND is processed and zero is returned Windows thinks you added it manually. What you need to do is create another switch statement.
If you do not process the msg then you need to return 1 else return 0. I think this will fix the problem you are having.Code://Inside WndProc
switch(msg){
//More cases
case WM_COMMAND:
switch(HIWORD(wParam)){ //This is the notification message
//Put cases based on control
return 0;
}
default: return 1;
//Finish switches
- Sean
>>When something is added it sends a WM_COMMAND.
My understanding is Treeviews return thru WM_NOTIFY not WM_COMMAND
Hence the TVN_XXXX msg's (TreeView Notify)