|
|
line 40 of timecore.cpp is
ASSERT(m_time != -1); // indicates an illegal input time
inside this constructor
CTime::CTime(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec,
int nDST)
{
struct tm atm;
atm.tm_sec = nSec;
atm.tm_min = nMin;
atm.tm_hour = nHour;
ASSERT(nDay >= 1 && nDay <= 31);
atm.tm_mday = nDay;
ASSERT(nMonth >= 1 && nMonth <= 12);
atm.tm_mon = nMonth - 1; // tm_mon is 0 based
ASSERT(nYear >= 1900);
atm.tm_year = nYear - 1900; // tm_year is 1900 based
atm.tm_isdst = nDST;
m_time = mktime(&atm);
ASSERT(m_time != -1); // indicates an illegal input time
}
|
|
|
|
|
A CTime object wraps a standard C time_t . This type cannot represent a date before 1 January 1970, and the assertion is telling you this.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
is there any method to resolve this problem? coz in my case I can't restrict input time to be after 1-1-1970
|
|
|
|
|
This works fine for me:
COleDateTime from(1968, 9, 6, 16, 10, 0),
to(2006, 4, 29, 16, 23, 15);
m_datetime.SetRange(&from, &to);
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
hi David, I tried your soluation, but the problem is still there, can you provide another simple sample? thanks
|
|
|
|
|
Perhaps I do not understand the problem. The code snippet I provided gives the control a minimum date of 6-Sep-1968, which is earlier than the 1-Jan-1970 date that was originally confining you. If you have a relevant code snippet that we could look at, we might be of more help.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
please give a example.
appreciate any help!!
|
|
|
|
|
All services need a local system account in order to run, or have I missed the point?
Ant.
|
|
|
|
|
CreateService(
scm,
szInternName, //internal name
szDisplayName, //display name
m_dwDesiredAccess, //desired access def: SERVICE_ALL_ACCESS
m_dwServiceType, //service type def: SERVICE_WIN32_OWN_PROCESS
m_dwStartType, //start type def: SERVICE_AUTOSTART
m_dwErrorControl, //error control def: SERVICE_ERROR_NORMAL
szFullPath, // exec name and full path
m_szLoadOrderGroup, //load order group def: none
m_lpdwTagID, //group tag ID def: none
m_szDependencies, //dependencies def: none
".\\Administrator", // user account name def:Local System
"password"); // user account password
hope everything else same ...
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
I am having the same problem. If you have done it already, could you guide me ragarding this?
|
|
|
|
|
Hi,
In Visual Basic, when working with objects, we have the following syntax:
<br />
obj.property=value or variable=obj.property<br />
call obj.method([params])<br />
Remember that the property is not only member variable which is declared with public modifier but the property can (and in fact its always) be a function. So we do not need to know where to store value or where the data of variable come from inside the object. More over, function inside property allows us to do few calculations based on value set or got.
My question here is: In Visual C, Could I implement such programming style, by any way?
At present, I implement such style by declaration a member variable as public member, but it may not good when working with object. Implementation Set , Get functions do not allow VB programming style.
Thanks for reading.
|
|
|
|
|
Extracted from MSDN:
__declspec( property( get=get_func_name ) ) declarator<br />
__declspec( property( put=put_func_name ) ) declarator<br />
__declspec( property( get=get_func_name, put=put_func_name ) ) declarator
This attribute can be applied to non-static “virtual data members” in a class or structure definition. The compiler treats these “virtual data members” as data members by changing their references into function calls.
When the compiler sees a data member declared with this attribute on the right of a member-selection operator (“.” or “->“), it converts the operation to a get or put function, depending on whether such an expression is an l-value or an r-value. In more complicated contexts, such as “+=“, a rewrite is performed by doing both get and put.
This attribute can also be used in the declaration of an empty array in a class or structure definition. For example:
__declspec(property(get=GetX, put=PutX)) int x[];
The above statement indicates that x[] can be used with one or more array indices. In this case, i=p->x[a][b]
will be turned into i=p->GetX(a, b) , and p->x[a][b] = i will be turned into p->PutX(a, b, i);
Gurmeet S. Kochar If you believe in God, it's because of the Devil
My CodeProject Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
Thank you very much.
Could you show me where to get that article in MSDN?
I am using MSDN October 2001. But I did not find your article in its. I think your idea is very interesting.
|
|
|
|
|
be careful, OOP is NOT available in C (so either in Visual C). object programming comes with C++.
And for your question, yes, you can.
Classes are made for such. You put your data members eito private or protected statements (in general) as properties, and the interface for your classe, defined with your function members ("methods" in VB) are in a public statement.
All of this is not definitive, but it is a cool way of programming properly.
TOXCCT >>> GEII power
|
|
|
|
|
I am trying to edit 2 C source files i downloaded... and re-convert the edited files into .exe's but i am having errors...
the error keeps stating:
"fatal error C1083: Cannot open include file: 'dir.h': No such file or directory"
i dont konw if dir.h is a header file that is missing and i need it before i can compile my source files.
is there any headers or other files that i must have in order to compile a source file into a .exe?
any help would be appreciated!
-Zac
"i bring a knife to a gun fight"
|
|
|
|
|
dir.h is not a VC++ header file. so for the building of your code i would suggest you to search the build environment for the code or if you want to build it on VC++ environment then remove the header and then compile the program. so you will see some compilation error like the particular function is not defined. try to get the subsitute of this function on VC++ library.
hope this will help you.
jitendra
|
|
|
|
|
I am using "straight C" (VC6.0) and want to change the background color of the edit-box part of a datetime control (this would be the part that is displayed in the dialog and contains the date that was selected via the drop-down calendar. I know you can change various parts of the calendar itself (by sending a MCM_SETCOLOR message with one of six parameters), but how can I change the color behind the date displayed in the 'edit' box part of the control? My dialog box background is a light yellow, and the (apparently default) background white color of the DTP control is distracting...
|
|
|
|
|
How do I set a tooltip on a tree control item?
I know I can call CTreeCtrl::SetToolTips() but that is for the control not each item in the tree control.
Can any one help me with this?
|
|
|
|
|
You'll have to add support yourself. There's a few examples on CP here[^] which will tell you how to do it.
"Oh, I'm sick of doing Japanese stuff! In jail we had to be in this dumb kabuki play about the 47 Ronin, and I wanted to be Oshi, but they made me Ori!"
|
|
|
|
|
I have a variable int that when I divide by 2, it all on it's own it divides by 4. By playing with it, I figured out that if I mulitply by about the square root of 2 / 2 the computer simply divides by two.
I've even rebuilt the whole project. The int is normally around 3,000,000 and the only thing I can think is that maybe it's larger than it may legally be.
So I tried casting it to double, but I got the same responce. Any and all help is greatly appreciated.
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
This is mighty weird. What are the exact lines of code that are doing the division?
|
|
|
|
|
int iDecryptID = m_iID;
iDecryptID /= 2;
return iDecryptID;
By returning m_iID I know that it is, in fact, the divison that is the problem.
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
Nope, the division is working properly.
The chance of a compiler error is very very very small.
If the output isn't matching the expected value, then the input isn't what you think it is or something else is going on.
With strange problems like this, 99.9999% of the time it is the programmer who is making assumptions that are wrong.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Can you post more context? I'm quite sure that,
#include <iostream%gt;
int Bogus ( int nTest )
{
int iPart = nTest ;
iPart /= 2 ;
return iPart ;
}
int main ()
{
std::cout << "Result of Bogus ( 3000000 ) = " << Bogus ( 3000000 ) << std::endl ;
return 0 ;
}<pre>
will be as expected.
Paul
|
|
|
|