Click here to Skip to main content
15,888,454 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: avi file on Status bar Pin
ptr_Electron7-Mar-08 5:21
ptr_Electron7-Mar-08 5:21 
GeneralRe: avi file on Status bar Pin
super_ttd7-Mar-08 7:02
super_ttd7-Mar-08 7:02 
GeneralRe: avi file on Status bar Pin
led mike7-Mar-08 7:18
led mike7-Mar-08 7:18 
GeneralRe: avi file on Status bar Pin
Randor 7-Mar-08 7:08
professional Randor 7-Mar-08 7:08 
GeneralRe: avi file on Status bar Pin
super_ttd7-Mar-08 7:13
super_ttd7-Mar-08 7:13 
GeneralRe: avi file on Status bar Pin
Randor 7-Mar-08 7:29
professional Randor 7-Mar-08 7:29 
GeneralRe: avi file on Status bar Pin
ptr_Electron10-Mar-08 23:56
ptr_Electron10-Mar-08 23:56 
GeneralRe: avi file on Status bar Pin
Randor 11-Mar-08 4:05
professional Randor 11-Mar-08 4:05 
Perhaps you should move to a message based inter-thread communication. You can even pass the percentage of completion.

Try something like this:

#define WM_START_ANIMATION WM_USER + 0x8
#define WM_INC_PROGRESS WM_USER + 0x10

void TestPb::OnButton1() 
{
thpbar=AfxBeginThread(thPrgbar,THREAD_PRIORITY_NORMAL,0,0,NULL);
}


UINT TestPb::thPrgbar( LPVOID pParam )
{
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();

::PostMessage(pFrame->GetSafeHwnd(),WM_START_ANIMATION,IDR_AVITEST,1);

int iCount;
int iPosition =0;
//Get count(*) from SQL DB and save into iCount;

// for each record in DB
while(reading DB)
{
// get 1 record
int iPercent = iCount * (iPosition / 100.0);
::PostMessage(pFrame->GetSafeHwnd(),WM_INC_PROGRESS,(WPARAM)iPercent,0);
++iPosition;
}
//end if
return (1);
}

void CMainFrame::OnStartAnimation( WPARAM id, WPARAM nPane /*=1*/ )
{
StopAnimation();
m_pAnimate = new CStatusbarAnimate;
m_pAnimate->Create(id, nPane);

}

void CMainFrame::StopAnimation()
{
if(IsAnimationActive())
{
delete m_pAnimate;
m_pAnimate = NULL;
}
}

bool CMainFrame::IsAnimationActive()
{
return (m_pAnimate != NULL);
}

// needed to ensure original text not visible
void CMainFrame::OnUpdateAnimate(CCmdUI* pCmdUI)
{
pCmdUI->SetText(_T(""));
} 

Add the following to your CMainFrame

///////
// ADD INTO YOUR CMainFrame HEADER FILE:
///////

afx_msg LRESULT OnMyProgress(WPARAM wParam, LPARAM lParam);

//////////
// ADD INTO YOUR CMainFrame MESSAGE MAP
/////////
ON_MESSAGE(WM_INC_PROGRESS,OnMyProgress)
ON_MESSAGE(WM_START_ANIMATION,OnStartAnimation)


//////////
// ADD INTO YOUR CMainFrame CPP file
/////////
LRESULT void CMainFrame::OnMyProgress(WPARAM wParam, LPARAM lParam)
{
int iPercent = (int)wParam;

if(100 == iPercent && IsAnimationActive())
{
StopAnimation();
}
else
{
// Update visuals here perhaps to reflect percentage of completion
}

GeneralRe: avi file on Status bar Pin
Rajkumar R7-Mar-08 3:42
Rajkumar R7-Mar-08 3:42 
GeneralRe: avi file on Status bar Pin
ptr_Electron7-Mar-08 4:34
ptr_Electron7-Mar-08 4:34 
GeneralRe: avi file on Status bar Pin
Nathan Holt at EMOM7-Mar-08 5:41
Nathan Holt at EMOM7-Mar-08 5:41 
QuestionSHFileOperation file deletion using the Recycle bin is SLOW!!! Pin
Member 38546007-Mar-08 2:53
Member 38546007-Mar-08 2:53 
AnswerRe: SHFileOperation file deletion using the Recycle bin is SLOW!!! Pin
Rajkumar R7-Mar-08 3:53
Rajkumar R7-Mar-08 3:53 
GeneralRe: SHFileOperation file deletion using the Recycle bin is SLOW!!! Pin
Member 38546007-Mar-08 5:05
Member 38546007-Mar-08 5:05 
GeneralRe: SHFileOperation file deletion using the Recycle bin is SLOW!!! Pin
led mike7-Mar-08 10:40
led mike7-Mar-08 10:40 
GeneralSetWindowContextHelpId always fails, Pin
ptr_Electron7-Mar-08 2:46
ptr_Electron7-Mar-08 2:46 
GeneralRe: SetWindowContextHelpId always fails, Pin
led mike7-Mar-08 4:17
led mike7-Mar-08 4:17 
Questionhow to wait for a file to be free? Pin
VCsamir7-Mar-08 2:33
VCsamir7-Mar-08 2:33 
AnswerRe: how to wait for a file to be free? Pin
CPallini7-Mar-08 2:34
mveCPallini7-Mar-08 2:34 
GeneralRe: how to wait for a file to be free? Pin
Hamid_RT9-Mar-08 0:58
Hamid_RT9-Mar-08 0:58 
AnswerRe: how to wait for a file to be free? Pin
Chris Meech7-Mar-08 3:01
Chris Meech7-Mar-08 3:01 
AnswerRe: how to wait for a file to be free? Pin
Hamid_RT9-Mar-08 0:57
Hamid_RT9-Mar-08 0:57 
GeneralLink file path from target path Pin
john56327-Mar-08 2:32
john56327-Mar-08 2:32 
GeneralRe: Link file path from target path Pin
Chris Losinger7-Mar-08 4:20
professionalChris Losinger7-Mar-08 4:20 
GeneralRe: Link file path from target path Pin
john56327-Mar-08 5:45
john56327-Mar-08 5:45 

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.