GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 08-Nov-2007, 20:18
robalo robalo is offline
New Member
 
Join Date: Nov 2007
Posts: 1
robalo is on a distinguished road

Progress Indicator called from other class fails


I have a simple dialog app which includes a progress indicator (CProgressCtrl). I have previously successfully managed to get this working by having a decoding program doing everything from the same class (dlg class).

The difference now is that I’m doing the decoding from other standard ANSI C++ classes. As I don’t want to “mess around” with those as they need to be compiled for different platforms, I though that I could update the decoding progress by a simple “method call”, e.g.

From other class:

CPP / C++ / C Code:
CMainDialogDlg dlg;
dlg.SetProgress(iPercent);

In main dialog class:

CPP / C++ / C Code:
void CMainDialogDlg::SetProgress(int progress)
{
	m_progress.SetPos(progress);
	UpdateData(FALSE);
}

But it seems like I lose the m_hWnd as I get Asserts, i.e.

CPP / C++ / C Code:
_AFXCMN_INLINE int CProgressCtrl::SetPos(int nPos)
	{ ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, PBM_SETPOS, nPos, 0L); }

BOOL CWnd::UpdateData(BOOL bSaveAndValidate)
{
	ASSERT(::IsWindow(m_hWnd)); // calling UpdateData before DoModal?

Is there a easy way to fix this or have I approached this problem completely wrong?

BR /// Rob
Last edited by LuciWiz : 11-Nov-2007 at 09:57. Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
  #2  
Old 08-Nov-2007, 23:47
dlp dlp is offline
Member
 
Join Date: May 2006
Posts: 101
dlp will become famous soon enough

Re: Progress Indicator called from other class fails


What kind of application are you making? A console or an MFC?

Also, what are the exact assert messages you get?
 
 

Recent GIDBlogWelcome to Baghdad by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Classes and allocating memory BlueFireCO. C++ Forum 13 26-Jul-2007 20:31
Hard drive/CPU Diagnoses Issues binarybug Computer Hardware Forum 1 22-Jan-2007 19:23
Message Class TransformedBG C++ Forum 5 29-Nov-2006 21:28
Box Class, need help again :( TransformedBG C++ Forum 7 13-Nov-2006 15:11
a tester class and then some. postage Java Forum 1 06-May-2006 15:48

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:21.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.