Microsoft KB Archive/137154

= FIX: ClassWizard Generates Bad Code for Tree View Messages =

Article ID: 137154

Article Last Modified on 10/24/2003

-

APPLIES TO


 * The ClassWizard, when used with:
 * Microsoft Visual C++ 2.1

-



This article was previously published under Q137154



SYMPTOMS
The Class Wizard generates the following incorrect code for the TVN_BEGINLABELEDIT, TVN_ENDLABELEDIT, TVN_GETDISPINFO, TVN_SETDISPINFO, and TVN_KEYDOWN Tree View Control notification messages. void CMyDialog::OnXXXXtreeview1(NMHDR* pNMHDR, LRESULT* pResult) {  NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; // TODO: Add your control notification hander code here *pResult = 0; }



RESOLUTION
For TVN_BEGINLABELEDIT, TVN_ENDLABELEDIT, TVN_GETDISPINFO, and TVN_SETDISPINFO, the pNMHDR parameter should be cast to a TV_DISPINFO*. For example: void CMyDialog::OnXXXXtreeview1(NMHDR* pNMHDR, LRESULT* pResult) {  TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR; // TODO: Add your control notification hander code here *pResult = 0; } For TVN_KEYDOWN, the pNMHDR parameter should be cast to a TV_KEYDOWN*. For example: void CMyDialog::OnXXXXtreeview1(NMHDR* pNMHDR, LRESULT* pResult) {  TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*)pNMHDR; // TODO: Add your control notification hander code here *pResult = 0; }



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in Visual C++ version 4.0.

Additional query words: 2.10

Keywords: kbbug kbfix kbnoupdate kbtreeview kbvc400fix kbwizard KB137154

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.