Click here to Skip to main content
15,885,782 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Need Help Debugging Program Pin
Stuart Dootson22-May-09 11:33
professionalStuart Dootson22-May-09 11:33 
QuestionViewing Design Pin
Ryuk199022-May-09 10:20
Ryuk199022-May-09 10:20 
AnswerRe: Viewing Design Pin
Stuart Dootson22-May-09 10:34
professionalStuart Dootson22-May-09 10:34 
GeneralRe: Viewing Design Pin
Ryuk199022-May-09 11:13
Ryuk199022-May-09 11:13 
QuestionAlgoritm in C Pin
cstic22-May-09 9:47
cstic22-May-09 9:47 
AnswerRe: Algoritm in C Pin
Garth J Lancaster22-May-09 18:17
professionalGarth J Lancaster22-May-09 18:17 
QuestionGlobal Keyboard hook works for a few seconds... Pin
mcfonseca22-May-09 7:58
mcfonseca22-May-09 7:58 
Questionprogress bar created in the status bar turns up uncovered the pane Pin
HelloDan200922-May-09 7:27
HelloDan200922-May-09 7:27 
Hello Friends!!!

I create a progress bar in the status bar. But that's a still something wrong. The progress bar which should occupied the pane rectangle fail to cover all the rectangle but leave some part uncovered, I can see the progress on the surface and the end part of the IDS_PROGRESS string text uncovered. I don't know how to correct it. If your can offer some help, I will really appreciate it. thanks!

I post the code as follows:

<br />
// Create the status bar<br />
BOOL CMainFrame::CreateStatusBar()<br />
{<br />
    static UINT nIndicators[] = {<br />
        ID_SEPARATOR,<br />
        IDS_PROGRESS,       //the pane for display the progress<br />
        IDS_TIMER,          // show current time <br />
        IDS_INDICATOR_POS,  // display the mouse position<br />
        ID_INDICATOR_LINE,// show the line number the cursor<br />
                           //position in <br />
        ID_INDICATOR_CAPS,<br />
        ID_INDICATOR_NUM<br />
    };<br />
<br />
    if (!m_wndStatusBar.Create (this))<br />
        return FALSE;<br />
<br />
    m_wndStatusBar.SetIndicators (nIndicators, 7);<br />
    return TRUE;<br />
}<br />
<br />
<br />
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)<br />
        return -1;<br />
    <br />
    //<br />
    // Tell the frame window to permit docking.<br />
    //<br />
    EnableDocking (CBRS_ALIGN_ANY);<br />
<br />
    //<br />
    // Create the toolbar, style bar, and status bar.<br />
    //<br />
    if (!CreateToolBar () ||<br />
        !CreateStyleBar ()||!CreateStatusBar())<br />
        return -1;<br />
    //<br />
    // Load the saved bar state (if any).<br />
    //<br />
    LoadBarState (_T ("MainBarState"));  <br />
    <br />
<br />
 //get one pane space to create progress bar <br />
    CRect rect;<br />
    m_wndStatusBar.GetItemRect(1,&rect);<br />
    m_Progress.Create(WS_CHILD|WS_VISIBLE|PBS_SMOOTH,rect,&m_wndStatusBar,IDS_PROGRESS);<br />
    <br />
<br />
    SetTimer(ID_TIME,500,NULL);  // For update the progress bar<br />
    return 0;<br />
}<br />
<br />
<br />
void CMainFrame::OnPaint() <br />
{<br />
    CPaintDC dc(this); // device context for painting<br />
    <br />
    // TODO: Add your message handler code here<br />
    if(m_Progress.GetSafeHwnd() != NULL)<br />
    {<br />
       CRect rect;<br />
       m_wndStatusBar.GetItemRect(1,&rect);<br />
       m_Progress.MoveWindow(rect);      <br />
    }<br />
    // Do not call CFrameWnd::OnPaint() for painting messages<br />
}<br />
<br />
<br />
void CMainFrame::OnTimer(UINT nIDEvent) <br />
{<br />
    // TODO: Add your message handler code here and/or call default<br />
     CTime time=CTime::GetCurrentTime();<br />
    int nHour=time.GetHour()%12;<br />
     int nMinu=time.GetMinute();<br />
    int nSecond=time.GetSecond();<br />
 <br />
     CString str;<br />
     str.Format(_T("%0.2d:%0.2d:%0.2d"),nHour,nMinu,nSecond);<br />
     if(m_wndStatusBar.GetSafeHwnd() != NULL)<br />
     {<br />
       CClientDC dc(this);    <br />
       CSize sz=dc.GetTextExtent("22:22:22");<br />
       m_wndStatusBar.SetPaneInfo(2,IDS_TIMER,SBPS_NORMAL,sz.cx);<br />
       m_wndStatusBar.SetPaneText(2,str); <br />
     }<br />
    <br />
    if(m_Progress.GetSafeHwnd() == NULL)<br />
    {<br />
      CRect rect;<br />
      m_wndStatusBar.GetItemRect(1,&rect);<br />
      m_Progress.Create(WS_CHILD|WS_VISIBLE|PBS_SMOOTH,rect,&m_wndStatusBar,IDS_PROGRESS);<br />
      m_Progress.SetRange(0,100);<br />
      m_Progress.SetPos(0);<br />
    }<br />
    m_Progress.StepIt();<br />
<br />
    CFrameWnd::OnTimer(nIDEvent);<br />
}<br />
<br />

QuestionDoes Postmessage/SendMessage require a Message Map entries Pin
ForNow22-May-09 6:38
ForNow22-May-09 6:38 
AnswerRe: Does Postmessage/SendMessage require a Message Map entries Pin
led mike22-May-09 8:37
led mike22-May-09 8:37 
GeneralRe: Does Postmessage/SendMessage require a Message Map entries Pin
ForNow22-May-09 10:50
ForNow22-May-09 10:50 
GeneralRe: Does Postmessage/SendMessage require a Message Map entries Pin
«_Superman_»22-May-09 16:21
professional«_Superman_»22-May-09 16:21 
GeneralRe: Does Postmessage/SendMessage require a Message Map entries Pin
ForNow23-May-09 15:33
ForNow23-May-09 15:33 
QuestionGPS & GoogleMap matching Pin
yunpil22-May-09 5:17
yunpil22-May-09 5:17 
AnswerRe: GPS & GoogleMap matching Pin
Stuart Dootson22-May-09 6:33
professionalStuart Dootson22-May-09 6:33 
RantRe: GPS & GoogleMap matching Pin
Rajesh R Subramanian23-May-09 0:39
professionalRajesh R Subramanian23-May-09 0:39 
QuestionOutlook email(.Msg ) file problem in vista explorer.... Pin
onlyjaypatel22-May-09 3:33
onlyjaypatel22-May-09 3:33 
QuestionCommand object execute parameters [modified] Pin
vital_parsley200022-May-09 2:56
vital_parsley200022-May-09 2:56 
QuestionRe: Command object execute parameters Pin
CPallini22-May-09 3:08
mveCPallini22-May-09 3:08 
AnswerRe: Command object execute parameters Pin
vital_parsley200022-May-09 4:01
vital_parsley200022-May-09 4:01 
GeneralRe: Command object execute parameters Pin
Stuart Dootson22-May-09 4:52
professionalStuart Dootson22-May-09 4:52 
GeneralRe: Command object execute parameters Pin
vital_parsley200022-May-09 5:13
vital_parsley200022-May-09 5:13 
GeneralRe: Command object execute parameters Pin
Stuart Dootson22-May-09 6:02
professionalStuart Dootson22-May-09 6:02 
GeneralRe: Command object execute parameters Pin
Stuart Dootson22-May-09 6:32
professionalStuart Dootson22-May-09 6:32 
GeneralRe: Command object execute parameters Pin
vital_parsley200022-May-09 19:01
vital_parsley200022-May-09 19:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.