Link to home
Start Free TrialLog in
Avatar of smpoojary
smpoojary

asked on

Modal dialog with Month Calendar(CMonthCalCtrl) :Error

hi all,

     I have created Modal dialog with Month Calendar(CMonthCalCtrl). While retreiving date I am getting wrong result. My code is like this

void DlgCal::OnSelchangeMonthcalendar1(NMHDR* pNMHDR, LRESULT* pResult)
{
      CTime ct;
      m_Date.GetCurSel(ct);
      int Day = ct.GetDay();

      *pResult = 0;
}

   I am checking  Day value while dubugging, it is giving wrong answer.

     Please clear my doubts
     With warm regards
     -Mahesh
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Member_2_1001466
Member_2_1001466

What is the result of GetCurSel (). Its return value is a BOOL which you don't check. If it returns 0 the function failed and you shouldn't expect any useful result in ct.
Avatar of smpoojary

ASKER

hi AndyAinscow,

   Very very thanks for AndyAinscow. Yes it is VC++ bug. I have used your code. Now my code is working. I am also greatful to SteH.

   Please tell me AndyAinscow, now I have only 5 points. How can I increase my points without pay money.

   smpoojary@yahoo.com
   With warm regards.
   -Mahesh
Two ways.
1) Keep coming here.  (I think it is something like 5 pts per day you accumulate)
2) Answer some questions (in any thread at EE) <if you can get more than 3000 ? points per month you can even qualify for an unlimited supply of points for you to ask questions with>
The limit is a bit higher. You qualify if you reach 10,000 points. And to continue to qualify you need to earn 3,000 points each month.
I'd forgotton the minimum requirement.
Don't forget it the total points, not specific to a topic area.
                                                                 Thanks for Everybody
hi AndyAinscow,

     If I use COleDateTime instead of CMonthCalCtrl in the above question, please tell me what is the solution.

     With warm regards.
     -Mahesh

     

In the sample code I gave you the m_dteCurrent is a COleDateTime variable.
hi AndyAinscow,

   if 'm_ctlMonth' type is COleDateTime instead of CMonthCatCtrl, is there any solution. Otherwise two variables we have to create to use it.

   With regards
   -Mahesh
COleDateTime is a 'wrapper class' for a variable - NO USER INTERFACE.  CMonthCalCtrl is a window based user interface for the user to select a date.  Two completely different things.
There is a CDateTimeCtrl however - is that what you meant?
hi AndyAinscow,

     Thanks a lot.
     With warm regards.
     -Mahesh

     
Thanks for SteH also.
With warm regards
-Mahesh