Click here to Skip to main content
16,005,682 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Capture Output from ShellExecute Pin
Ravi Bhavnani29-Jul-04 7:03
professionalRavi Bhavnani29-Jul-04 7:03 
GeneralRe: Capture Output from ShellExecute Pin
pruthvis4-May-10 0:49
pruthvis4-May-10 0:49 
GeneralCWnd question Pin
act_x29-Jul-04 6:05
act_x29-Jul-04 6:05 
GeneralRe: CWnd question Pin
PJ Arends29-Jul-04 7:16
professionalPJ Arends29-Jul-04 7:16 
GeneralSpecific POST/GET request header Pin
Member 78763029-Jul-04 6:04
Member 78763029-Jul-04 6:04 
GeneralRe: Specific POST/GET request header Pin
Ravi Bhavnani29-Jul-04 6:24
professionalRavi Bhavnani29-Jul-04 6:24 
GeneralRe: Specific POST/GET request header Pin
Jeff Bogan29-Jul-04 6:25
Jeff Bogan29-Jul-04 6:25 
GeneralOwn ProgressBar Pin
act_x29-Jul-04 4:45
act_x29-Jul-04 4:45 
I am working on an SDI app .
I have a view and its creates a Window(CWnd). this window has sub components like edit boxes , Buttons etc . I wanted to create my own Control like a ProgressBar and add it as a componenet to the window .

i did this to create the control
class CProgressBar : public CWnd  <br />
{<br />
public:<br />
	CProgressBar(CWnd *parent);<br />
	int value;<br />
	virtual ~CProgressBar();<br />
<br />
protected:<br />
	//{{AFX_MSG(CBar)<br />
	afx_msg void OnPaint();<br />
	//}}AFX_MSG<br />
	DECLARE_MESSAGE_MAP()<br />
<br />
};
1) When I was about to create this class , I went to the class View and clicked ADD class .
What class should it be MFC or non MFC ?
If i select MFC , i never get CWnd as an option of a Base class

Because of which I created a generic class and added the afx call .

what is the right way of doing this ?


Here is my .cpp file
<br />
BEGIN_MESSAGE_MAP(CProgressBar, CWnd)<br />
	//{{AFX_MSG_MAP(CProgressBar)<br />
	ON_WM_PAINT()<br />
	//}}AFX_MSG_MAP<br />
END_MESSAGE_MAP()<br />
<br />
CProgressBar::CProgressBar(CWnd *parent):CWnd(parent)<br />
{<br />
	value=0;<br />
<br />
}<br />
<br />
CProgressBar::~CProgressBar()<br />
{<br />
<br />
}<br />
<br />
void CProgressBar::OnPaint()<br />
{<br />
   CPaintDC dc(this); // device context for painting<br />
   CWnd::OnPaint();<br />
   CRect r;<br />
   this->GetClientRect(&r);<br />
   dc.TextOut(0,0,"I am here");<br />
<br />
   dc.FillSolidRect(r,RGB(255,0,0));<br />
}


2) In the Windows (thats created by the View ) I do this
progress = new CProgressBar(this);

and later create it here :
void CSelfTest :: OnPaint()<br />
{<br />
	CPaintDC dc(this); // device context for painting<br />
	switch(state){<br />
		case SELFTEST_INIT:		  <br />
                  ..<br />
                  ...<br />
		  idRect.top+=10*MINIMUM_SPACING;<br />
		  idRect.bottom=idRect.top+50;<br />
<br />
		  progress->Create("CProgressBar","Progress",WS_VISIBLE,idRect,this,1234);<br />
		  progress->Invalidate();<br />
		  break;<br />
         }<br />
}

The breakPoint that I set in the OnPaint of CprogressBar never gets called and the call to
progress->Invalidate() crashes !!

Please help
GeneralRe: Own ProgressBar Pin
Jaime Stuardo29-Jul-04 7:43
Jaime Stuardo29-Jul-04 7:43 
QuestionHow do I insert an audio stream to video file? Pin
javih51129-Jul-04 3:49
javih51129-Jul-04 3:49 
Generalsend() and recv() sockets Pin
ns29-Jul-04 3:31
ns29-Jul-04 3:31 
GeneralRe: send() and recv() sockets Pin
Peter Weyzen29-Jul-04 10:49
Peter Weyzen29-Jul-04 10:49 
GeneralIrDA traffic statistics Pin
dima_matrix29-Jul-04 3:22
dima_matrix29-Jul-04 3:22 
Generalprogram like the norton ghost Pin
X204029-Jul-04 2:59
X204029-Jul-04 2:59 
Generalexample code of using IPicture to save bitmap image as gif, jpg ... Pin
includeh1029-Jul-04 2:30
includeh1029-Jul-04 2:30 
Questionwher is search engine to find a poster? Pin
includeh1029-Jul-04 2:24
includeh1029-Jul-04 2:24 
AnswerRe: wher is search engine to find a poster? Pin
David Crow29-Jul-04 3:11
David Crow29-Jul-04 3:11 
AnswerRe: wher is search engine to find a poster? Pin
Michael P Butler29-Jul-04 3:32
Michael P Butler29-Jul-04 3:32 
GeneralRe: wher is search engine to find a poster? Pin
includeh1029-Jul-04 5:40
includeh1029-Jul-04 5:40 
GeneralRe: wher is search engine to find a poster? Pin
Michael P Butler29-Jul-04 5:44
Michael P Butler29-Jul-04 5:44 
GeneralRe: wher is search engine to find a poster? Pin
includeh1029-Jul-04 6:03
includeh1029-Jul-04 6:03 
GeneralMultiple project solution Pin
HohohoMyHo29-Jul-04 1:31
HohohoMyHo29-Jul-04 1:31 
GeneralRe: Multiple project solution Pin
SOCM_FP_CPP29-Jul-04 2:29
SOCM_FP_CPP29-Jul-04 2:29 
GeneralRe: Multiple project solution Pin
HohohoMyHo29-Jul-04 2:43
HohohoMyHo29-Jul-04 2:43 
GeneralRe: Multiple project solution Pin
HohohoMyHo29-Jul-04 4:03
HohohoMyHo29-Jul-04 4:03 

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.