Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - marquee progress ctrl on statusbar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

marquee progress ctrl on statusbar

 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: marquee progress ctrl on statusbar
    Posted: 29 June 2009 at 4:10am
I am trying to put progress control on the status bar and am using the code from example Statusbar:
 

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)

{

..............
SetupStatusBarProgress();

return 0;

}

 

void CMainFrame::SetupStatusBarProgress()

{

// Create the edit control and add it to the status bar

if (!m_ProgressCtrl.Create(WS_CHILD|WS_VISIBLE|PBS_SMOOTH,

CRect(0,0,0,0), &m_wndStatusBar, 0))

{

TRACE0("Failed to create edit control.\n");

return;

}

// add the indicator to the status bar.

CXTPStatusBarPane* pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_PROG);

// Initialize the pane info and add the control.

int nIndex = m_wndStatusBar.CommandToIndex(ID_INDICATOR_PROG);

ASSERT (nIndex != -1);

pPane->SetCaption(pPane->GetText());

pPane->SetText(_T(""));

m_wndStatusBar.SetPaneWidth(nIndex, 150);

m_wndStatusBar.SetPaneStyle(nIndex, m_wndStatusBar.GetPaneStyle(nIndex) | SBPS_NOBORDERS);

m_wndStatusBar.AddControl(&m_ProgressCtrl, ID_INDICATOR_PROG, FALSE);

// initialize progress control.

m_ProgressCtrl.SetRange (0, 100);

m_ProgressCtrl.SetPos (0);

m_ProgressCtrl.SetStep (1);

pPane->SetCustomizationVisible(FALSE);

}

then, before the long operation starts I call the following function that in normal circumstances produces marquee-style progress bar...

void CMainFrame::StartMarqueeProgress()

{

m_ProgressCtrl.ShowWindow(SW_SHOW);

// Set the progress control style to PBS_MARQUEE

//

HWND hWnd = m_ProgressCtrl.GetSafeHwnd();

LONG_PTR dwLong = GetWindowLongPtr(hWnd, GWL_STYLE);

LONG_PTR dwNewLong = dwLong | PBS_MARQUEE;

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

// set progress control to blue

//

DWORD dwColor;

CBluetoothControllerApp* pApp = (CBluetoothControllerApp*)AfxGetApp();

if (pApp->IsVista())

dwColor = RGB(0,255,0);

else

dwColor = GetSysColor(COLOR_ACTIVECAPTION);

LRESULT lResult = m_ProgressCtrl.SendMessage(PBM_SETBARCOLOR, // message ID

0, // must be 0

dwColor); // normal color

DWORD dwTime;

if ( pApp->IsVista() )

dwTime = 10;

else

dwTime = 30;

lResult = m_ProgressCtrl.SendMessage(

(UINT)PBM_SETMARQUEE, // message ID

(WPARAM)TRUE, // set to marqee

(LPARAM) dwTime); // time in milisec between updates

}

I get no results... not only the marquee is not displayed, but nothing is displayed on the status bar... Anything I am doing wrong here?
 
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.141 seconds.