Solved

Modal dialog with Month Calendar(CMonthCalCtrl) :Error

Posted on 2004-09-09
13
383 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Installing Microsoft R server on REDHAT or SUSE Linux 4 137
Add content to output file 4 63
sumDigits challenge 9 150
tripleUp challenge 7 79
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

772 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