I noticed when working through the tab control example that the message you send to the tab control to delete the selected tab is incorrect. You currently have:
SendMessageW(hTab, TCM_DELETEITEM, 0, id);
and it should be:
SendMessageW(hTab, TCM_DELETEITEM, id, 0);
The text correctly says that the tab id should be passed in the wParam.