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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Vista specific CToolBar problem

Vista specific CToolBar problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++data-structureslearning
2 Posts 1 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.
  • M Offline
    M Offline
    Manu Dev
    wrote on last edited by
    #1

    Hi All, I have an old vc++ application which was running perfectly fine on Win NT and Win XP. (I use VC++ 7 to build it) Now i am running it on Vista. While opening one perticular view it throws an unhandelled exception and simply dies. After debugging I found that the exception is being thrown when i try to add buttons to my dynamic tool bar. The code structure is : There is a CDynamicToolBar derived from CToolBar class CDynamicToolBar : public CToolBar When I need to instantiates the dynamic tool bar i do something like this

    //call my constructor
    m_wndToolBar = new CDynamicToolBar (/*reqd parameters*/)
    //call create function
    if (!m_wndToolBar->CreateEx(this))
    {//handel error }
    //call my function to load all buttons, bitmaps, etc.
    m_wndToolBar->Load();
    //continue

    Its in the Load() ,where I add the buttons array I am getting the exception in Vista while there is no problem in XP

    GetToolBarCtrl().AddButtons(iButtonCount+iSeptratorCount, pAToolBarButton);

    I have tried removing the code related to the tool bar and running the view without it on Vista. It gives no problem at all (except,i don't get the toolbar of course) I am completely at loss here... Anyone with ideas /suggestion/ :-D solutions

    only dead fish swim with the stream

    M 1 Reply Last reply
    0
    • M Manu Dev

      Hi All, I have an old vc++ application which was running perfectly fine on Win NT and Win XP. (I use VC++ 7 to build it) Now i am running it on Vista. While opening one perticular view it throws an unhandelled exception and simply dies. After debugging I found that the exception is being thrown when i try to add buttons to my dynamic tool bar. The code structure is : There is a CDynamicToolBar derived from CToolBar class CDynamicToolBar : public CToolBar When I need to instantiates the dynamic tool bar i do something like this

      //call my constructor
      m_wndToolBar = new CDynamicToolBar (/*reqd parameters*/)
      //call create function
      if (!m_wndToolBar->CreateEx(this))
      {//handel error }
      //call my function to load all buttons, bitmaps, etc.
      m_wndToolBar->Load();
      //continue

      Its in the Load() ,where I add the buttons array I am getting the exception in Vista while there is no problem in XP

      GetToolBarCtrl().AddButtons(iButtonCount+iSeptratorCount, pAToolBarButton);

      I have tried removing the code related to the tool bar and running the view without it on Vista. It gives no problem at all (except,i don't get the toolbar of course) I am completely at loss here... Anyone with ideas /suggestion/ :-D solutions

      only dead fish swim with the stream

      M Offline
      M Offline
      Manu Dev
      wrote on last edited by
      #2

      what! no replies! ;P Anyway the problem is solved. in the line

      GetToolBarCtrl().AddButtons(iButtonCount+iSeptratorCount, pAToolBarButton);

      pAToolBarButton is an array of TBBUTTON structure where each structure represents a button on the tool bar. It seems that each field in TBBUTTON structure must be properly initialized in Vista. Well this is a good programming practice anyway. But in case you have left the less used fields like TBBUTTON.dwValue uninitialized, it would ignored when you application runs on XP. Where as in Vista you get an exception when you try to add the buttons to your toolbar control.

      only dead fish swim with the stream

      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