请教一个关于时间函数的问题
COleDateTime todays=COleDateTime::GetCurrentTime();
这句写的有什么问题,为什么运行不了呢?
问题点数:10、回复次数:4Top
1 楼snowtramp(初级者)回复于 2006-03-19 11:17:04 得分 0
这是COleDateTime类的函数体
class COleDateTime
{
// Constructors
public:
static COleDateTime PASCAL GetCurrentTime();
COleDateTime();
COleDateTime(const COleDateTime& dateSrc);
COleDateTime(const VARIANT& varSrc);
COleDateTime(DATE dtSrc);
COleDateTime(time_t timeSrc);
COleDateTime(const SYSTEMTIME& systimeSrc);
COleDateTime(const FILETIME& filetimeSrc);
COleDateTime(int nYear, int nMonth, int nDay,
int nHour, int nMin, int nSec);
COleDateTime(WORD wDosDate, WORD wDosTime);
// Attributes
public:
enum DateTimeStatus
{
valid = 0,
invalid = 1, // Invalid date (out of range, etc.)
null = 2, // Literally has no value
};
DATE m_dt;
DateTimeStatus m_status;
void SetStatus(DateTimeStatus status);
DateTimeStatus GetStatus() const;
BOOL GetAsSystemTime(SYSTEMTIME& sysTime) const;
int GetYear() const;
int GetMonth() const; // month of year (1 = Jan)
int GetDay() const; // day of month (0-31)
int GetHour() const; // hour in day (0-23)
int GetMinute() const; // minute in hour (0-59)
int GetSecond() const; // second in minute (0-59)
int GetDayOfWeek() const; // 1=Sun, 2=Mon, ..., 7=Sat
int GetDayOfYear() const; // days since start of year, Jan 1 = 1
// Operations
public:
const COleDateTime& operator=(const COleDateTime& dateSrc);
const COleDateTime& operator=(const VARIANT& varSrc);
const COleDateTime& operator=(DATE dtSrc);
const COleDateTime& operator=(const time_t& timeSrc);
const COleDateTime& operator=(const SYSTEMTIME& systimeSrc);
const COleDateTime& operator=(const FILETIME& filetimeSrc);
BOOL operator==(const COleDateTime& date) const;
BOOL operator!=(const COleDateTime& date) const;
BOOL operator<(const COleDateTime& date) const;
BOOL operator>(const COleDateTime& date) const;
BOOL operator<=(const COleDateTime& date) const;
BOOL operator>=(const COleDateTime& date) const;
// DateTime math
COleDateTime operator+(const COleDateTimeSpan& dateSpan) const;
COleDateTime operator-(const COleDateTimeSpan& dateSpan) const;
const COleDateTime& operator+=(const COleDateTimeSpan dateSpan);
const COleDateTime& operator-=(const COleDateTimeSpan dateSpan);
// DateTimeSpan math
COleDateTimeSpan operator-(const COleDateTime& date) const;
operator DATE() const;
int SetDateTime(int nYear, int nMonth, int nDay,
int nHour, int nMin, int nSec);
int SetDate(int nYear, int nMonth, int nDay);
int SetTime(int nHour, int nMin, int nSec);
BOOL ParseDateTime(LPCTSTR lpszDate, DWORD dwFlags = 0,
LCID lcid = LANG_USER_DEFAULT);
// formatting
CString Format(DWORD dwFlags = 0, LCID lcid = LANG_USER_DEFAULT) const;
CString Format(LPCTSTR lpszFormat) const;
CString Format(UINT nFormatID) const;
// Implementation
protected:
void CheckRange();
friend COleDateTimeSpan;
};
Top
2 楼Mackz(在相互)回复于 2006-03-19 11:21:23 得分 0
COleDateTime todays=COleDateTime::GetCurrentTime();
这句话没有问题。怎么运行不了?Top
3 楼snowtramp(初级者)回复于 2006-03-19 11:24:30 得分 0
程序一到这里就死悄悄了。不知道咋回事呀,郁闷的。。。。
Top
4 楼snowtramp(初级者)回复于 2006-03-19 11:32:23 得分 0
这是调试信息。
其中出现了内存泄露,但偶看不懂,看请指点一下。
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MFC42D.DLL', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MSVCRTD.DLL', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MFCO42D.DLL', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\lpk.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\usp10.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\mfc42loc.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\uxtheme.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MSCTF.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MSCTFIME.IME', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comctl32.dll', no matching symbolic information found.
Detected memory leaks!
Dumping objects ->
strcore.cpp(118) : {120} normal block at 0x00375D08, 17 bytes long.
Data: < > 01 00 00 00 04 00 00 00 04 00 00 00 BE CD D0 F7
strcore.cpp(118) : {98} normal block at 0x003759E8, 19 bytes long.
Data: < > 01 00 00 00 06 00 00 00 06 00 00 00 CE DE B1 EA
array_p.cpp(110) : {96} normal block at 0x00375990, 20 bytes long.
Data: < 8L7 > 00 00 00 00 38 4C 37 00 00 00 00 00 CD CD CD CD
array_p.cpp(71) : {95} normal block at 0x00375948, 4 bytes long.
Data: < > 00 00 00 00
winfrm2.cpp(66) : {94} client block at 0x00375860, subtype 0, 168 bytes long.
a CDockBar object at $00375860, 168 bytes long
array_p.cpp(71) : {93} normal block at 0x00375818, 4 bytes long.
Data: < > 00 00 00 00
winfrm2.cpp(66) : {92} client block at 0x00375730, subtype 0, 168 bytes long.
a CDockBar object at $00375730, 168 bytes long
array_p.cpp(71) : {91} normal block at 0x003756E8, 4 bytes long.
Data: < > 00 00 00 00
winfrm2.cpp(66) : {90} client block at 0x00375600, subtype 0, 168 bytes long.
a CDockBar object at $00375600, 168 bytes long
winfrm2.cpp(66) : {88} client block at 0x00375518, subtype 0, 168 bytes long.
a CDockBar object at $00375518, 168 bytes long
bardock.cpp(735) : {87} normal block at 0x003752D0, 176 bytes long.
Data: < !K_ > DC 21 4B 5F CD CD CD CD CD CD CD CD CD CD CD CD
strcore.cpp(118) : {86} normal block at 0x003754C0, 17 bytes long.
Data: < > 01 00 00 00 04 00 00 00 04 00 00 00 B9 F6 B6 AF
strcore.cpp(118) : {85} normal block at 0x00375468, 17 bytes long.
Data: < > 01 00 00 00 04 00 00 00 04 00 00 00 CA FD D7 D6
strcore.cpp(118) : {84} normal block at 0x00375410, 17 bytes long.
Data: < > 01 00 00 00 04 00 00 00 04 00 00 00 B4 F3 D0 B4
{80} normal block at 0x003751B0, 80 bytes long.
Data: < > 00 00 00 00 00 01 00 00 00 01 00 08 00 00 00 00
plex.cpp(31) : {77} normal block at 0x003750F8, 124 bytes long.
Data: < Q7 8L7 > 00 00 00 00 08 51 37 00 00 00 00 00 38 4C 37 00
plex.cpp(31) : {76} normal block at 0x00375040, 124 bytes long.
Data: < O7 > 00 00 00 00 00 00 00 00 00 00 00 00 B8 4F 37 00
D:\Program Files\Microsoft Visual Studio\MyProjects\ex08a\ex08aView.cpp(19) : {75} client block at 0x00374FB8, subtype 0, 68 bytes long.
a CEx08aView object at $00374FB8, 68 bytes long
strcore.cpp(118) : {71} normal block at 0x00374D98, 18 bytes long.
Data: < ex08> 01 00 00 00 05 00 00 00 05 00 00 00 65 78 30 38
D:\Program Files\Microsoft Visual Studio\MyProjects\ex08a\MainFrm.cpp(18) : {69} client block at 0x00374AF8, subtype 0, 480 bytes long.
a CMainFrame object at $00374AF8, 480 bytes long
D:\Program Files\Microsoft Visual Studio\MyProjects\ex08a\ex08aDoc.cpp(18) : {68} client block at 0x00374A60, subtype 0, 84 bytes long.
a CEx08aDoc object at $00374A60, 84 bytes long
plex.cpp(31) : {67} normal block at 0x003749A8, 124 bytes long.
Data: < H7 > 00 00 00 00 00 00 00 00 00 00 00 00 20 48 37 00
{66} client block at 0x00374940, subtype 0, 32 bytes long.
a CDocManager object at $00374940, 32 bytes long
strcore.cpp(118) : {65} normal block at 0x003748C8, 57 bytes long.
Data: < , , ex08> 01 00 00 00 2C 00 00 00 2C 00 00 00 65 78 30 38
D:\Program Files\Microsoft Visual Studio\MyProjects\ex08a\ex08a.cpp(74) : {64} client block at 0x00374820, subtype 0, 108 bytes long.
a CSingleDocTemplate object at $00374820, 108 bytes long
strcore.cpp(118) : {62} normal block at 0x003747C8, 19 bytes long.
Data: < File> 01 00 00 00 06 00 00 00 06 00 00 00 46 69 6C 65
strcore.cpp(118) : {61} normal block at 0x00374760, 29 bytes long.
Data: < Rece> 01 00 00 00 10 00 00 00 10 00 00 00 52 65 63 65
{60} normal block at 0x00374708, 20 bytes long.
Data: < M_ M_ M_> 04 00 00 00 14 0B 4D 5F 14 0B 4D 5F 14 0B 4D 5F
{59} normal block at 0x003746A0, 32 bytes long.
Data: < K_ G7 lG7 > CC AD 4B 5F 04 00 00 00 0C 47 37 00 6C 47 37 00
Object dump complete.
The thread 0xD14 has exited with code 3 (0x3).
The program 'D:\Program Files\Microsoft Visual Studio\MyProjects\ex08a\Debug\ex08a.exe' has exited with code 3 (0x3).Top




