?
Solved

Modal dialog with Month Calendar(CMonthCalCtrl) :Error

Posted on 2004-09-09
13
Medium Priority
?
394 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 180 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
Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

 
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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month13 days, 8 hours left to enroll

800 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