Solved

Modal dialog with Month Calendar(CMonthCalCtrl) :Error

Posted on 2004-09-09
13
389 Views
Last Modified: 2013-11-20
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
Comment
Question by:smpoojary
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 2
13 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 45 total points
ID: 12024430
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
 
LVL 13

Expert Comment

by:SteH
ID: 12024452
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
 
LVL 4

Author Comment

by:smpoojary
ID: 12025116
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
Technology Partners: 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!

 
LVL 44

Expert Comment

by:AndyAinscow
ID: 12025337
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
 
LVL 13

Expert Comment

by:SteH
ID: 12025608
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
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 12025830
I'd forgotton the minimum requirement.
Don't forget it the total points, not specific to a topic area.
0
 
LVL 4

Author Comment

by:smpoojary
ID: 12061606
                                                                 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
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 12062149
In the sample code I gave you the m_dteCurrent is a COleDateTime variable.
0
 
LVL 4

Author Comment

by:smpoojary
ID: 12062345
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
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 12062468
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
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 12062559
There is a CDateTimeCtrl however - is that what you meant?
0
 
LVL 4

Author Comment

by:smpoojary
ID: 12063186
hi AndyAinscow,

     Thanks a lot.
     With warm regards.
     -Mahesh

     
0
 
LVL 4

Author Comment

by:smpoojary
ID: 12063194
Thanks for SteH also.
With warm regards
-Mahesh
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Generic progress indicator 6 121
How to know only "File created" with EventLog 3 35
Doc'in system (example?) BA 7 126
Problem to Office 1 63
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question