|
This seems so simple but I'm lost, because the web talks about SetFormat() but the class method just does not seem to exists in my C++ 6.0 version.
tried this
case WM_TIMER:
if((HWND)lParam==GetDlgItem(hwndDlg,IDC_DATETIMEPICKER4))::Set????((HDC)wParam,_T("dd-MMM-yy"));
tried this: (assertion error occurs)
// Gain a pointer to the control
CDateTimeCtrl* pCtrl = (CDateTimeCtrl*) GetDlgItem(hwndDlg,IDC_DATETIMEPICKER4);
ASSERT(pCtrl != NULL);
pCtrl->SetFormat(_T("dd-MMM-yy"));
Any ideas?
|
|
|
|
|
Don Jones BNYMellon wrote: tried this: (assertion error occurs)
What assertion error, this one?
Don Jones BNYMellon wrote: ASSERT(pCtrl != NULL);
If so that means the control( IDC_DATETIMEPICKER4) has not been created.
Aside: It is more practical when forming comparison expressions of variables to constants, to place the constant on the left side of the comparison statement NULL != pCtrl . This way the compiler will error if you typo the statement into NULL = pCtrl whereas it won't if you typo pCtrl = NULL
|
|
|
|
|
Thanks for reply
Got the date --- debug shows someting is not happy Needs the Window Handle?
// Gain a pointer to the control
char datetext[25];
EnableWindow(GetDlgItem(hwndDlg,IDC_DATETIMEPICKER4),true);
GetDlgItemText(hwndDlg,IDC_DATETIMEPICKER4,datetext,25);
CDateTimeCtrl* pCtrl = (CDateTimeCtrl*) GetDlgItem(hwndDlg,IDC_DATETIMEPICKER4);
ASSERT(pCtrl != NULL);
debug
+ datetext 0x0011f16c "4/15/2009"
+ hwndDlg 0x00050736
+ pCtrl 0x00000000 {CDateTimeCtrl hWnd=???}
|
|
|
|
|
Don Jones BNYMellon wrote: ...the web talks about SetFormat() but the class method just does not seem to exists in my C++ 6.0 version.
Have you looked in afxdtcl.h (line 50)?
Rather than force a particular format, why not use whatever Windows has been configured for?
"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
|
|
|
|
|
Nice call but got another solution, so I don't have to change afxdtc.h
Here's what works.
if(cpi->eurodate!=1){
SendDlgItemMessage(hwndDlg,IDC_DATETIMEPICKER4,DTM_SETFORMAT,0,LPARAM("MM'/'dd'/'yyyy"));}
if(cpi->eurodate==1){
SendDlgItemMessage(hwndDlg,IDC_DATETIMEPICKER4,DTM_SETFORMAT,0,LPARAM("dd'/'MM'/'yyyy"));}
Thanks for all your help....
|
|
|
|
|
Don Jones BNYMellon wrote: ...so I don't have to change afxdtc.h
Nothing was ever mentioned about changing it, only to verify that the method exists.
Don Jones BNYMellon wrote: if(cpi->eurodate==1){
Why do this check if the other check evaluated to true (i.e, cpi->eurodate can't be both 1 and not 1 ).
"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
|
|
|
|
|
Sorry, you are correct and it is there... interesting... eventhou I included this header...
// Attributes
COLORREF GetMonthCalColor(int iColor) const;
COLORREF SetMonthCalColor(int iColor, COLORREF ref);
BOOL SetFormat(LPCTSTR pstrFormat);
CMonthCalCtrl* GetMonthCalCtrl() const;
CFont* GetMonthCalFont() const;
void SetMonthCalFont(HFONT hFont, BOOL bRedraw = TRUE);
|
|
|
|
|
To answer your seconrd question:
This is a 3rd party app which has a switch for EURO Date Format or NOT. I support a DLL that interfaces with another system. Yes, like you I would have used Windows configuration.
thanks again...
|
|
|
|
|
Don Jones BNYMellon wrote: This is a 3rd party app which has a switch for EURO Date Format or NOT.
I understand that, but there's still no reason to perform both if() tests when only one of them can evaluate to true. I would imagine that the compiler would realize that and perform the necessary optimization, but still.
"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
|
|
|
|
|
I have a problem like i need to include a different header files depending on the linux kernel in a .cpp file. I have to check the linux kernel version and include the headerfile depending on that kernel. How can I do that?
I have ARCH variable in Makefile, can i make use of that?
|
|
|
|
|
Best way it to first include keranal version.h file in your project (ex:"/usr/include/linux/version.h"), and then put below checks in your code.
#if RHEL_MAJOR == 5
#include "xyx_5.h"
#else
#include "xyx.h"
#endif
Parag Patel
Sr. Software Eng, Varaha Systems
|
|
|
|
|
lOOKS LIKE this doesn't work for me. I saw the version.h file, it has got 3 lines as below.
#define UTS_RELEASE "2.4.20"
#define LINUX_VERSION_CODE 132116
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
And I want to differentiate kernels for 2.4 and 2.6. Is the above code still works with it.I've placed my code as below, but it seems not working.
#include "/usr/include/linux/version.h"
#if RHEL_MAJOR=2.4.20
#include "../../build/i686-Linux-2.4.32/ReleaseVersion.hh"
#else
#include "../../build/i686-Linux-2.6.21/ReleaseVersion.hh"
#endif
What went wrong in my case.
Thanks in advance
|
|
|
|
|
Try below code,
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,0)
#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#endif // 2.4
#endif //2.6
Parag Patel
Sr. Software Eng, Varaha Systems
|
|
|
|
|
Thanks a lot man. It's working.
|
|
|
|
|
Hi All,
I have problem with my project linking. It fails and the errors are
error LNK2001: unresolved external symbol __RTC_Shutdown
error LNK2001: unresolved external symbol __RTC_InitBase
error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z)
error LNK2001: unresolved external symbol ___security_cookie
and a lot such us.
Can anybody tell me what can be the reason?
Thanks
|
|
|
|
|
venera_soft wrote: Can anybody tell me what can be the reason?
Not linking with the correct library, perhaps?
"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
|
|
|
|
|
The strange part of this is that i could build the sources before installing the oldest version of WinDDK. And i have never changed any lib files that are linked to my project.
Thanks anyway.
|
|
|
|
|
Looks like you're linking against the wrong C/C++ run-time libraries. Check that the correct Visual Studio directories are in the VC++ library path (Tools->Options->Projects and Solutions->VC++ Directories and select 'Library files' for the 'Show directories for:' combobox).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi. Thanks for answer but it's ok with the Library Files.
|
|
|
|
|
Hi all,
I have a customized ListCtrl, and Called SetTimer() but OnTimer() handler will execute only once..
And I does not called any KillTimer(),
My OnTimer is Like this
<br />
void ListCtrlEx::OnTimer( UINT nIDEvent_i )<br />
{<br />
if( 100 == nIDEvent_i )<br />
{<br />
}<br />
CListCtrl::OnTimer( nIDEvent_i );<br />
}<br />
<br />
SetTimer( 100, 300, 0 );<br />
Any possible reason for the same
Regards,
Radhakrishnan G.
|
|
|
|
|
Don't called default OnTimer of CListCtrl, for your timer ID.
void ListCtrlEx::OnTimer( UINT nIDEvent_i )
{
if( 100 == nIDEvent_i )
{
// Do some thing
}
else
{
CListCtrl::OnTimer( nIDEvent_i );
}
}
Parag Patel
Sr. Software Eng, Varaha Systems
|
|
|
|
|
Yes, Its working
Actually I made a mistake..
Thanks
Please find my 5 Votes.
|
|
|
|
|
I am using MFC Treeview control in my application. For each tree node has some images. usually the image is left side of the tree node but i would like to add this image after the text of the node.
Can you please suggest some ways to do this?
Thanks in advance.
|
|
|
|
|
You will probably need to have to handle NM_CUSTOMDRAW and do the drawing yourself.
This signature was proudly tested on animals.
|
|
|
|
|