CDateTimeCtrl in MFC - How to Use?
-
I have two DateTime picker Controls in my dialog: (1) One is for collecting the Users selected date(style is: :spin Control) the other control is (2) simply collects the time the User selects. In (1) which selection do you select in the Property Page for the control, ie, DTN_DATETIMECHANGED, etc. And once you have made that selection what is the code (in MFC) for retrieving the data? In (2) which selection do you select in the Property Page for the control, ie, DTN_DATETIMECHANGED, etc. And once you have made that selection what is the code (in MFC) for retrieving the data? I want to insure the format recieved is hh:mm (no seconds).I need sample code for each control: (1) and (2). I need working examples; if you do not have such, don't bother responding, PLEASE!
A C++ programming language novice, but striving to learn
-
I have two DateTime picker Controls in my dialog: (1) One is for collecting the Users selected date(style is: :spin Control) the other control is (2) simply collects the time the User selects. In (1) which selection do you select in the Property Page for the control, ie, DTN_DATETIMECHANGED, etc. And once you have made that selection what is the code (in MFC) for retrieving the data? In (2) which selection do you select in the Property Page for the control, ie, DTN_DATETIMECHANGED, etc. And once you have made that selection what is the code (in MFC) for retrieving the data? I want to insure the format recieved is hh:mm (no seconds).I need sample code for each control: (1) and (2). I need working examples; if you do not have such, don't bother responding, PLEASE!
A C++ programming language novice, but striving to learn
Larry Mills Sr wrote:
...what is the code (in MFC) for retrieving the data?
Use the
GetTime()
method."Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Larry Mills Sr wrote:
...what is the code (in MFC) for retrieving the data?
Use the
GetTime()
method."Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
David, the first (1) picker has an assigned varable of m_cDate and the second (2) has an assigned varable of m_cTime. if I use CString str = m_cDate.GetTime() will it return a str with the value in the picker? and should this value be received in the DTN_DATETIMECHANGED notification function or what function should I select in the PropertyPage for the picker? I don't know, that's why I'm asking?
A C++ programming language novice, but striving to learn
-
David, the first (1) picker has an assigned varable of m_cDate and the second (2) has an assigned varable of m_cTime. if I use CString str = m_cDate.GetTime() will it return a str with the value in the picker? and should this value be received in the DTN_DATETIMECHANGED notification function or what function should I select in the PropertyPage for the picker? I don't know, that's why I'm asking?
A C++ programming language novice, but striving to learn
Larry Mills Sr wrote:
David, the first (1) picker has an assigned varable of m_cDate...if I use CString str = m_cDate.GetTime() will it return a str with the value in the picker?
No, it "returns" a
SYSTEMTIME
pointer, aCOleDateTime
object, or aCTime
object."Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Larry Mills Sr wrote:
David, the first (1) picker has an assigned varable of m_cDate...if I use CString str = m_cDate.GetTime() will it return a str with the value in the picker?
No, it "returns" a
SYSTEMTIME
pointer, aCOleDateTime
object, or aCTime
object."Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Simply put; how do I get the value the User has selected in the picker into a CString? simple code plese!
A C++ programming language novice, but striving to learn
-
Simply put; how do I get the value the User has selected in the picker into a CString? simple code plese!
A C++ programming language novice, but striving to learn
Did you look at any of the three objects I referenced? Use one of those along with
CString::Format()
."Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Did you look at any of the three objects I referenced? Use one of those along with
CString::Format()
."Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
If you are talking about this: "No, it "returns" a SYSTEMTIME pointer, a COleDateTime object, or a CTime object." I still don't understand how what the User selects will be relayed to the instance of one of these " "returns" a SYSTEMTIME pointer, a COleDateTime object, or a CTime object." when You initialize the m_cDatew or m_cTime varables with one of those; how will it also retrieve the User's response? Wouldn't you receive back the same initialization you inputed to the varables?
A C++ programming language novice, but striving to learn
-
If you are talking about this: "No, it "returns" a SYSTEMTIME pointer, a COleDateTime object, or a CTime object." I still don't understand how what the User selects will be relayed to the instance of one of these " "returns" a SYSTEMTIME pointer, a COleDateTime object, or a CTime object." when You initialize the m_cDatew or m_cTime varables with one of those; how will it also retrieve the User's response? Wouldn't you receive back the same initialization you inputed to the varables?
A C++ programming language novice, but striving to learn
Larry Mills Sr wrote:
I still don't understand how what the User selects will be relayed to the instance of one of these " "returns" a SYSTEMTIME pointer, a COleDateTime object, or a CTime object."
By using the
GetTime()
method. It comes in three different flavors depending on what type of object you want in return."Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons