Print Page | Close Window

ProgressControl on CommandBar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=14798
Printed Date: 27 February 2025 at 3:37pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: ProgressControl on CommandBar
Posted By: securigy
Subject: ProgressControl on CommandBar
Date 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 ?



Replies:
Posted By: Oleg
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net