Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. problem with context menu code

problem with context menu code

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionhelplearning
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ivansla
    wrote on last edited by
    #1

    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 .

    M M 2 Replies Last reply
    0
    • I ivansla

      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 .

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      check line 5.


      Maximilien Lincourt Your Head A Splode - Strong Bad

      1 Reply Last reply
      0
      • I ivansla

        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 .

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        Looks like line 5 should have used the = operator instead. Mark

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups