Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - ProgressControl on CommandBar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ProgressControl on CommandBar

 Post Reply Post Reply
Author
Message
securigy View Drop Down
Groupie
Groupie


Joined: 23 November 2007
Status: Offline
Points: 41
Post Options Post Options   Thanks (0) Thanks(0)   Quote securigy Quote  Post ReplyReply Direct Link To This Post Topic: ProgressControl on CommandBar
    Posted: 22 July 2009 at 10:06pm
I can easily add progress control to command ba like shown in the example:
 

CXTPToolBar* pToolBarProgress = pCommandBars->Add(_T("Progress"), xtpBarTop);

pToolBarProgress->GetControls()->Add(xtpControlLabel, 0)->SetCaption(_T("CXTPControlProgress:"));

m_pToolbarProgressCtrl = new CXTPControlProgress();

m_pProjectWizBar->GetControls()->Add((CXTPControl*)m_pToolbarProgressCtrl);

BOOL bVista = ((CBluetoothControllerApp*)AfxGetApp())->IsVista();

m_pToolbarProgressCtrl->Init(bVista, TRUE, bVista ? 10 : 30, 100, 1);

However I can't make it Marquee style since the CXTPControlProgress class is derived from CXTPControl and others that are not derived from CWnd and therefore cannot be used to send windows message that sets the marquee style:

HWND hWnd = GetSafeHwnd();

LONG_PTR dwLong = GetWindowLongPtr(hWnd, GWL_STYLE);

LONG_PTR dwNewLong = dwLong | PBS_MARQUEE;

dwLong = SetWindowLongPtr(hWnd, GWL_STYLE, (LONG)dwNewLong);

LRESULT lResult = this->SendMessage((UINT)PBM_SETMARQUEE,// message ID

(WPARAM)TRUE, // set to marqee

(LPARAM) m_nMarqueeDelay); // time in milisec between update

I tried to derive my own progress ctrl from CProgressControl but then the following line crashes (not sure why I was expecting a miracle)
m_pProjectWizBar->GetControls()->Add((CXTPControl*)m_pToolbarProgressCtrl);
 
Is there any other way to make progress control marquee-style on the command bar ?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 24 July 2009 at 4:12am
Hi,
 
Check \Samples\CommandBars\CommonControls  - shows how add standard controls to toolbar.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.051 seconds.