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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
S

soaringpilot

@soaringpilot
About
Posts
5
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • MFC help : code error 0000007B
    S soaringpilot

    OK, so this means you fixed one problem (I think), but now came up against another. I believe 7B meant that command format was wrong that is why I was suggesting the ':' the 2 means that system cannot find COM3. Are you sure that it exists. On a Windows PC you'd look in device manager. If it really exists then 7B probably means something else. That is about all I can help. Henryk

    C / C++ / MFC help c++ com debugging

  • Responding To Asynchronous Functions
    S soaringpilot

    Sounds like you need a multithreaded application. With one thread set up to wait for the call while another is doing the normal processing. On the other hand it kind of depends on what you mean by asynchronous. Windows message pump is is another example of managing asynchronous events. Cheers, Henryk

    C / C++ / MFC question

  • MFC help : code error 0000007B
    S soaringpilot

    I do not recognize the open_host_port function, but it does not really matter. On some systems you need to add a ':' after COMx. Try sprintf(COMportName, "%s%d:", COMportPrefix, COMportNum); to get COM3: Cheers, Henryk

    C / C++ / MFC help c++ com debugging

  • How do I check or change text in a VS2008 menu bar menu item
    S soaringpilot

    Thanks! that works. I guess it is another disconnect in MFC :( .

    C / C++ / MFC question help

  • How do I check or change text in a VS2008 menu bar menu item
    S soaringpilot

    I must be doing something really stupid, but... I cannot get any of the changes to my menu items reflected in visual appearance. If I check a menu item, or change string I can see changes if I test in code, but not when I click on the menu bar. I use standard default bar creation in main frame OnCreate:

    CMFCVisualManager::SetDefaultManager(RUNTIME\_CLASS(CMFCVisualManagerWindows));
    if (!m\_wndMenuBar.Create(this))
    {
    	TRACE0("Failed to create menubar\\n");
    	return -1;      // fail to create
    }
    m\_wndMenuBar.SetPaneStyle(m\_wndMenuBar.GetPaneStyle() | CBRS\_SIZE\_DYNAMIC | CBRS\_TOOLTIPS | CBRS\_FLYBY);
    

    I then create a menu message handler in a view and in it I put something like this:

    MENUITEMINFO info;
    TCHAR buf\[32\];
    
    info.cbSize=sizeof(MENUITEMINFO);
    info.fMask=MIIM\_STATE|MIIM\_ID|MIIM\_STRING;
    info.fType=MFT\_STRING;
    info.dwTypeData=0;
    
    HMENU hMenusafe= ((CMainFrame\*)(AfxGetApp()->m\_pMainWnd))->m\_wndMenuBar.GetHMenu();
    HMENU hMenu=::GetSubMenu(hMenusafe,0);
    DWORD err=GetLastError();
    int er=GetMenuItemInfo(hMenu,3,1,&info);
     err=GetLastError();
     info.cch++;
     if( info.cch > 32)
    	  info.cch = 32;
     info.dwTypeData=buf;
     er=GetMenuItemInfo(hMenu,3,1,&info);
     err=GetLastError();
    
    if(info.fState & MFS\_CHECKED)
    {
    	info.fState &=~MFS\_CHECKED;
    	info.fState|=MFS\_UNCHECKED;
    	\_tcscpy(buf,\_T("Menu is unchecked"));
    	info.cch=\_tcslen(buf)+1;		
    }
    else
    {
    	info.fState &=~MFS\_UNCHECKED;
    	info.fState  |=MFS\_CHECKED;
    	\_tcscpy(buf,\_T("Menu is checked"));
    	info.cch=\_tcslen(buf)+1;
    }
    
    er=SetMenuItemInfo(hMenu,3,1,&info);
    ((CMainFrame\*)(AfxGetApp()->m\_pMainWnd))->DrawMenuBar();
    

    As I click on the menu item I never see a check, nor changed text. However as I am stepping through the code debugging, I see that changes did take place. What am I doing wrong? Any help appreciated Henryk

    C / C++ / MFC question help
  • Login

  • Don't have an account? Register

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