Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 396
  • Last Modified:

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
0
smpoojary
Asked:
smpoojary
  • 6
  • 5
  • 2
1 Solution
 
AndyAinscowCommented:
I think there might be a problem in the monthcal control itself.

This is from an app

      SYSTEMTIME sysTime;
      if(m_ctlMonth.SendMessage(MCM_GETCURSEL, 0, (LPARAM) &sysTime))
            m_dteCurrent.SetDate(sysTime.wYear, sysTime.wMonth, sysTime.wDay);


the sysTime.wDay should be the day
0
 
SteHCommented:
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.
0
 
smpoojaryAuthor Commented:
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
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
AndyAinscowCommented:
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>
0
 
SteHCommented:
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.
0
 
AndyAinscowCommented:
I'd forgotton the minimum requirement.
Don't forget it the total points, not specific to a topic area.
0
 
smpoojaryAuthor Commented:
                                                                 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

     

0
 
AndyAinscowCommented:
In the sample code I gave you the m_dteCurrent is a COleDateTime variable.
0
 
smpoojaryAuthor Commented:
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
0
 
AndyAinscowCommented:
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.
0
 
AndyAinscowCommented:
There is a CDateTimeCtrl however - is that what you meant?
0
 
smpoojaryAuthor Commented:
hi AndyAinscow,

     Thanks a lot.
     With warm regards.
     -Mahesh

     
0
 
smpoojaryAuthor Commented:
Thanks for SteH also.
With warm regards
-Mahesh
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now