problem with context menu code
-
Hi, I'm a begginer in this programming stuff, and I learn visual C++ from the book "teach yourself visual c++ in 21 days". anyway I am on the 6th day now and I have a small problem with the menu code. here is the listing: 1.CMenu *m_lMenu; 2.CPoint m_pPoint; 3.m_pPoint = point; 4.ClientToScreen(&m_pPoint); 5.m_lMenu - GetMenu(); 6.m_lMenu = m_lMenu->GetSubMenu(0); 7.m_lMenu->TrackPopupMenu(TPM_CENTERALIGN + TPM_LEFTBUTTON, m_pPoint.x, m_pPoint.y, this, NULL); now when I compile my project ( ofcourse there is other code which works just fine), compiler gives me 2 warnings: D:\C\projects\menus\menusDlg.cpp(203) : warning C4552: '>>' : operator has no effect; expected operator with side-effect D:\C\projects\menus\menusDlg.cpp(204) : warning C4700: local variable 'm_lMenu' used without having been initialized this code is copied from the book so if there is error then the error is in th book. So my question is what is the problem? my guess is that there is something wrong with line 5 (m_lMenu - GetMenu()) make's no sense right? or is the problem in something other? I tried even with -> and .
-
Hi, I'm a begginer in this programming stuff, and I learn visual C++ from the book "teach yourself visual c++ in 21 days". anyway I am on the 6th day now and I have a small problem with the menu code. here is the listing: 1.CMenu *m_lMenu; 2.CPoint m_pPoint; 3.m_pPoint = point; 4.ClientToScreen(&m_pPoint); 5.m_lMenu - GetMenu(); 6.m_lMenu = m_lMenu->GetSubMenu(0); 7.m_lMenu->TrackPopupMenu(TPM_CENTERALIGN + TPM_LEFTBUTTON, m_pPoint.x, m_pPoint.y, this, NULL); now when I compile my project ( ofcourse there is other code which works just fine), compiler gives me 2 warnings: D:\C\projects\menus\menusDlg.cpp(203) : warning C4552: '>>' : operator has no effect; expected operator with side-effect D:\C\projects\menus\menusDlg.cpp(204) : warning C4700: local variable 'm_lMenu' used without having been initialized this code is copied from the book so if there is error then the error is in th book. So my question is what is the problem? my guess is that there is something wrong with line 5 (m_lMenu - GetMenu()) make's no sense right? or is the problem in something other? I tried even with -> and .
-
Hi, I'm a begginer in this programming stuff, and I learn visual C++ from the book "teach yourself visual c++ in 21 days". anyway I am on the 6th day now and I have a small problem with the menu code. here is the listing: 1.CMenu *m_lMenu; 2.CPoint m_pPoint; 3.m_pPoint = point; 4.ClientToScreen(&m_pPoint); 5.m_lMenu - GetMenu(); 6.m_lMenu = m_lMenu->GetSubMenu(0); 7.m_lMenu->TrackPopupMenu(TPM_CENTERALIGN + TPM_LEFTBUTTON, m_pPoint.x, m_pPoint.y, this, NULL); now when I compile my project ( ofcourse there is other code which works just fine), compiler gives me 2 warnings: D:\C\projects\menus\menusDlg.cpp(203) : warning C4552: '>>' : operator has no effect; expected operator with side-effect D:\C\projects\menus\menusDlg.cpp(204) : warning C4700: local variable 'm_lMenu' used without having been initialized this code is copied from the book so if there is error then the error is in th book. So my question is what is the problem? my guess is that there is something wrong with line 5 (m_lMenu - GetMenu()) make's no sense right? or is the problem in something other? I tried even with -> and .
Looks like line 5 should have used the = operator instead. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: