|
I see what you mean, apart from maintianing your own list I can't see a solution
Have a look at MSDN ID: Q221542
Unless there is something like _tsetlocale, which sets the time and not just the locale.
Happy hunting!
|
|
|
|
|
If no-one answered your post the first time, posting again twenty minutes is unlikely to help (although, of course, in this particular case... )
This first error is the one you want to look at. All the others are caused by it as well. You need to find which header file CDate is defined in and #include it.
Although a quick scan of the MSDN seems to indicate that there's no such class - did you just make it up?
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
First of all, every request is urgent to the person asking. It helps if instead you say what it's about.
Once your compiler finds a problem, it is confused and will probably find many more which really relate back to the first one. So don't worry about the big list.
Basically, your compiler does not know what a CDate is. To tell it, you need to include the header that declares it. I searched MSDN for CDate in MFC and it could not find it. Unless MSDN is not working in this case ( very possible ) MFC does not define a CDate class, and the standard sure doesn't. Where did you get the code you're using from ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
hi,
make sure u r including afx.h and instead of CDate (What is that?) use CTime.
a bit of suggestion
try using COleDateTime instead of CTime (Include afxdisp.h). the implementation of this class is similiar to CTime but it offers u a wide range of dates.
regards
rishabhs
|
|
|
|
|
Check if m_sDate is in the scope from where you are trying to access(have you declared it somewhere ?) , the second error is because of the first one.
Cheers
Kannan
|
|
|
|
|
CWhateverDateTypeYouEndedUpUsed m_MyDate;
Obviously not literally, but that is what you've failed to do somewhere.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
m_sTime is a CString and you've not created it. Put CString m_sTime; in your header file.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
a tip for more efficienct programming ->
instead of using 2 objects curDate & curTime, u can use a single COleDateTime object to get the date as well as time.
anyways,
to extract day, month etc values from COleDateTime obj,
u can use Format Function.
eg.
COleDateTime::GetCurrentTime().Format( "%a, %d/%m/%Y %H:%M:%S ")
where a , d, m, H etc. means weekday, day, month etc.
rishabhs
"If something looks easy, it's actually difficult. But if somethings looks difficult, it's damn IMPOSSIBLE" (Murphy's Laws)
Cheers!
|
|
|
|
|
dear all,
i'm creating an mfc app and i want to check if the info about my application is stored in registry or not.
how do i go about it?
and how to save my entries if the don't exist?
regards,
rishabhs
|
|
|
|
|
Take a look at RegCreateKey api.
First you need to decide on where you want your app. specific settings to be stored in the registry, typically it would be HKEY_CURRENT_USER\Software\<app name="">
once decided you can use the above API to create (for the first time) or Open the key if it already exist.
Alternately, if you can also try using this ATL class CRegKey
Also if you are using VC++ wizard to generate MFC code, have a look at InitInstance function, where there is a call to SetRegistryKey function.
Cheers
Kannan
|
|
|
|
|
Hi..
you all know the auto-complete thing that vc have..
you know.. when you write a function you have this vars tha need to be pasted to the function. or if you have a class object something like CSring obj and you write obj. then youll have this drop down list of all then function and vars inside it...
so.. for some reason it stoped working in here(Only the DirectX funtion, The win32 API is OK)...
how in the name of all gods do i set it back to work..
What I do is:
1): Set the right Include & Lib path and put them to the top
2); close the VC, delte the *.ncb file, Then opent the VC, but it' wrong also
What should I do ??!!
It's me, code_cold
|
|
|
|
|
|
Hi all, i have these errors can i know how to solve them....
Thanks.
>>can i know how to declare identifier..
D:\diana\Updated Project 29 Nov\DeviceActiveX\DeviceDlg.cpp(238) : error C2065: 'CDate' : undeclared identifier
D:\diana\Updated Project 29 Nov\DeviceActiveX\DeviceDlg.cpp(238) : error C2653: 'CDate' : is not a class or namespace name
D:\diana\Updated Project 29 Nov\DeviceActiveX\DeviceDlg.cpp(242) : error C2228: left of '.Format' must have class/struct/union type
D:\diana\Updated Project 29 Nov\DeviceActiveX\DeviceDlg.cpp(242) : error C2228: left of '.GetDay' must have class/struct/union type
D:\diana\Updated Project 29 Nov\DeviceActiveX\DeviceDlg.cpp(243) : error C2228: left of '.GetMonth' must have class/struct/union type
D:\diana\Updated Project 29 Nov\DeviceActiveX\DeviceDlg.cpp(244) : error C2228: left of '.GetYear' must have class/struct/union type
|
|
|
|
|
Hi,
There is no class 'CDate' in MFC so you can't make an instance of it. For your needs you should use class 'CTime' which deals with date and time.
As an alternative you can write your own class 'CDate' which fulfills all your needs.
--
karl
|
|
|
|
|
hi
is there any function to get MAC address in VC++.
i need it urgently. can anyone help me.please...
|
|
|
|
|
|
I'd like to implement my own "Confirm File Delete" message box, but I can't seem to get the message string in the MessageBox() method to wrap. So, when removing a file with a long filename, the message box shows up really wide.
Is there some way to limit the size of a MessageBox()? Or some way to tell the string to wrap after X number of characters?
Jonah Bishop
Visit JGB Productions
|
|
|
|
|
|
Hello,
I got the following question: I got a character array called oldblock which is going to be transfered via tcp socket to a linux machine. This works great so far. A file is read blockwise and transfered as well. So for performance purposes, before the block is sent to the socket I want it to be compressed via zip or any other useable compression algo and to be decompressed on the other side of the socket pipe. Hope you understand...Excuse my bad english, I'm from germany... A function looking like this would be great:
newblocksize = compress( char* oldblock, char* newblock, int oldblocksize);
where oldblock points to the uncompressed character array of size oldblocksize and newblock is a pointer to a character array of size newblocksize where the compressed data is stored. And on the other side a similar function turning around that process... decompressing instead of compressing, ya understand?!
Where can I find something like that for C++ platform independent?
ThanX for your answers and have a fine xmas!
|
|
|
|
|
|
I use the LZSS algorithm extensively
because it is dead simple to implement
(under a 100 lines of code easy)
and fast during decompression.
Here's a link[^].
There are plenty more via Google[^].
No patent issues [^]either.
Sigh... always check for the lawyer bait...
|
|
|
|
|
I've derived my own class from CListCtrl and am doing some processing when an item is selected i.e. via LVN_ITEMCHANGED. However, I want to distinguish between an item being selected via a mouse click and the keyboard.
So, I thought I would trap WM_LBUTTONDOWN/UP except that I never seem to get the WM_LBUTTONUP message. I can see the message being sent in Spy but I never seem to receive it. I can't even trap it in PreTranslateMessage(). Trying to capture the mouse with GetCapture() doesn't work either. But I get it if I double-click.
Anyone know what's going on?
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
That silly list view sure can be a PITA sometimes. This happened to me a couple months ago, and I have really no idea why it won't let you get the WM_LBUTTONUP in the single-click case. The solution I found to check for the single-click is to handle the NM_CLICK notification message. I don't know how much this will help, but good luck.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
Thanks for that.
I thought about that but I would still need some way of knowing to then ignore the LVN_ITEMCHANGED.
Unless I ignore LVN_ITEMCHANGED all together but then I would have to process keyboard input myself to detect selection changes there. As you said, a serious PITA
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
I wouldn't skip the LVN_ITEMCHANGED. Handling all the cases would be a real PITA. I was just checking the order that the messages are sent in, and I've discovered this order:
WM_LBUTTONDOWN
LVN_ITEMCHANGED
NM_CLICK
So, it appears that you could do something like this pseudo-code:
void CYourClass::OnLButtonDown( blah blah )
{
m_bLButtonDown = TRUE;
}
void CYourClass::OnItemChanged( blah blah )
{
if( m_bLButtonDown )
{
}
else
{
}
}
void CYourClass::OnClick( blah blah )
{
m_bLButtonDown = FALSE;
}
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|