Click here to Skip to main content
15,909,652 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to hook the system events, such as shutoff? Pin
Randor 31-Jul-08 16:14
professional Randor 31-Jul-08 16:14 
GeneralRe: How to hook the system events, such as shutoff? Pin
kcynic31-Jul-08 16:20
kcynic31-Jul-08 16:20 
GeneralRe: How to hook the system events, such as shutoff? Pin
Mark Salsbery31-Jul-08 16:24
Mark Salsbery31-Jul-08 16:24 
QuestionQuiz or Test program help needed.. Pin
the oso31-Jul-08 13:13
the oso31-Jul-08 13:13 
QuestionRe: Quiz or Test program help needed.. Pin
CPallini31-Jul-08 21:59
mveCPallini31-Jul-08 21:59 
AnswerRe: Quiz or Test program help needed.. Pin
David Crow1-Aug-08 3:15
David Crow1-Aug-08 3:15 
AnswerRe: Quiz or Test program help needed.. Pin
hoxsiew3-Aug-08 4:59
hoxsiew3-Aug-08 4:59 
QuestionClass Creation Problem Pin
Like2Byte31-Jul-08 12:46
Like2Byte31-Jul-08 12:46 
Hi,

I'm working in MFC using VS 2003.net in UNMANAGED code - MFC (not .NET).

I've a class. It has two constructors.

typedef enum calibDataType_e
{
	CDT_UNKNOWN_E = 0,
	CDT_REGISTER_E,
	CDT_END_E		/*Keep as last*/
} calibDataType_t;

//the class
class CCalibEntry : public CDialog
{
public:
   CString csLabel;
   CString csValue;
   float fValue;
   enum { IDD = IDD_VALUEENTRY };
public:
   CCalibEntry(CString csLabel, CWnd* pParent = NULL);
   CCalibEntry(CString csLabel, calibDataType_t pt = CDT_UNKNOWN_E, CWnd* pParent = NULL);
protected:
   bool   IsValidEntry();
   bool   ValidateRegisterEntry();
   virtual BOOL OnInitDialog();
   virtual void OnOK();
   afx_msg void OnDestroy( );
   DECLARE_MESSAGE_MAP()
private:
   int dataType;
};


//The constructors. Note the differing constructor signatures
CCalibEntry::CCalibEntry (CString csLabel, CWnd *pParent) : CDialog (IDD, pParent), dataType(CDT_UNKNOWN_E)
{
    this->csLabel = csLabel;
}

CCalibEntry::CCalibEntry (CString csLabel, calibDataType_t dt, CWnd *pParent) : CDialog (IDD, pParent)
{
    this->csLabel = csLabel;
   dataType = dt;

   if( dataType == CDT_REGISTER_E )
   {
      //provide a hint to the user
      csValue = _T("0.0.0");
   }
}


When this code is called via:

CCalibEntry dlg ( message, CDT_REGISTER_E, this );

It enters BOTH constructors. (Whereas, as I understand it, it should only enter:
"CCalibEntry::CCalibEntry (CString csLabel, calibDataType_t dt, CWnd *pParent) : CDialog (IDD, pParent)"

Oddly enough, it also enters OnInitDialog *after* the user presses the 'OK' key.Mad | :mad:

W...T...H?

1) Isn't just the constructor with the matching signature the *ONLY* constructor to be entered?

I've cleaned by project and rebuild from scratch, pulled from source control & rebuilt again, deleted NCB files.

2) Also, setting breakpoints in the second contructor code at, say, the top line ("this->csLabel = csLabel;") results in the breakpoint being *moved* to the line with the comment ("//provide a hint to the user") -- as if the comment line is going to execute some code. Thoughts?

Signed,
Frustrated! WTF | :WTF:
AnswerRe: Class Creation Problem Pin
Mark Salsbery31-Jul-08 13:13
Mark Salsbery31-Jul-08 13:13 
GeneralRe: Class Creation Problem Pin
Like2Byte31-Jul-08 14:18
Like2Byte31-Jul-08 14:18 
GeneralRe: Class Creation Problem Pin
Mark Salsbery31-Jul-08 14:51
Mark Salsbery31-Jul-08 14:51 
GeneralRe: Class Creation Problem Pin
Like2Byte1-Aug-08 4:14
Like2Byte1-Aug-08 4:14 
GeneralRe: Class Creation Problem Pin
Mark Salsbery1-Aug-08 6:11
Mark Salsbery1-Aug-08 6:11 
Questionhow can store an image into Ms Access with Visual C 2005 Pin
hafini31-Jul-08 9:59
hafini31-Jul-08 9:59 
QuestionRe: how can store an image into Ms Access with Visual C 2005 Pin
David Crow31-Jul-08 10:43
David Crow31-Jul-08 10:43 
AnswerRe: how can store an image into Ms Access with Visual C 2005 Pin
hafini31-Jul-08 17:37
hafini31-Jul-08 17:37 
GeneralRe: how can store an image into Ms Access with Visual C 2005 Pin
David Crow1-Aug-08 3:07
David Crow1-Aug-08 3:07 
GeneralRe: how can store an image into Ms Access with Visual C 2005 Pin
hafini1-Aug-08 6:22
hafini1-Aug-08 6:22 
QuestionRe: how can store an image into Ms Access with Visual C 2005 Pin
David Crow1-Aug-08 6:26
David Crow1-Aug-08 6:26 
AnswerRe: how can store an image into Ms Access with Visual C 2005 Pin
hafini1-Aug-08 6:33
hafini1-Aug-08 6:33 
AnswerRe: how can store an image into Ms Access with Visual C 2005 Pin
hafini31-Jul-08 17:41
hafini31-Jul-08 17:41 
QuestionMultiple GdiplusStartup GdiplusShutdown Calls Pin
FossilDocent31-Jul-08 9:48
FossilDocent31-Jul-08 9:48 
QuestionRe: Multiple GdiplusStartup GdiplusShutdown Calls Pin
Mark Salsbery31-Jul-08 9:51
Mark Salsbery31-Jul-08 9:51 
AnswerRe: Multiple GdiplusStartup GdiplusShutdown Calls Pin
FossilDocent31-Jul-08 9:55
FossilDocent31-Jul-08 9:55 
GeneralRe: Multiple GdiplusStartup GdiplusShutdown Calls Pin
Mark Salsbery31-Jul-08 10:13
Mark Salsbery31-Jul-08 10:13 

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.