|
Hi,
I'm making use of the following:
typedef struct _EVENTLOGRECORD {
...
DWORD TimeGenerated;
...
}
Thus the following won't work
TimeGenerated = pevlr->TimeGenerated;
newtime = localtime( TimeGenerated );
How can I convert it?
Many thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
|
what are the functions you are using to retrieve this number?
|
|
|
|
|
chandu004 wrote: what are the functions you are using to retrieve this number?
ReadEventLog() and then I'm making use of the struct EVENTLOGRECORD *pevlr; (pevlr->TimeGenerated;)
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
In VC++ I use:
void CMyDoc::FormatTime ()
{ CTime time = CTime::GetCurrentTime();
CString szStartTime = time.Format ( "%A, %d.%B.%Y, %H:%M:%S" );
//Do whatever you want
return;
}
On the other hand... you can always make the conversion by yourself.
60 * 60 * 24 * 365 = 31536000 // Seconds in a year
60 * 60 * 24 = 86400 // Seconds in a day
3600 // Seconds in an hour
...............
TimeGenerated = 1183355639
int years = TimeGenerated / 31536000;
int rest1 = TimeGenerated % 31536000;
int day = rest1 / 86400;
int rest2 = rest1 % 86400;
and so on...
To get month, day of the week and other things you can work in a similar way.
I hope it helps
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
.h file........................
#if !defined(AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_)
#define AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CStream:public CObject
{
public:
CStream();
CStream(CString &strName,CString &strAge,CString &strDep,CString &strNo);
virtual ~CStream();
CString m_strName;
CString m_strAge;
CString m_strDep;
CString m_strNo;
};
class CStreams:public CList<cstream*,cstream*>
{
public:
CStream * Find(CString& sIDStream);
CStreams();
virtual ~CStreams();
void AddStream(CString& sName, CString& sAge,CString &sDep,CString &sNo);
};
#endif // !defined(AFX_STREAM_H__76EBFBD3_73B0_11D7_9C8F_0050BA3C5F89__INCLUDED_)
THIS R THE ERRORS I GOT PLEASE HELP ME
i have given the implementation in .cpp file also...........
this r the errors.............
Compiling...
CStream.cpp
e:\getstart\cllectdlg\cstream.h(27) : error C2504: 'CList' : base class undefined
e:\getstart\cllectdlg\cstream.h(27) : error C2143: syntax error : missing ',' before '<'
e:\getstart\cllectdlg\cstream.h(27) : error C2059: syntax error : '<'
E:\GetStart\Cllectdlg\CStream.cpp(61) : error C2065: 'AddTail' : undeclared identifier
Error executing cl.exe.
Cllectdlg.exe - 4 error(s), 0 warning(s)
|
|
|
|
|
Did you include the header file of CList ?
|
|
|
|
|
Did you include afxtempl.h ?
|
|
|
|
|
as the others said, the header file for CList is not included
if you want to have an example of working with templates of collections take a look to the Smart Lists in:
Simon Huge's article[^]
My Article[^]
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
bhogavalli suresh wrote: e:\getstart\cllectdlg\cstream.h(27) : error C2504: 'CList' : base class undefined
Notice the header requirements here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
I'm using the following function to read the Source of the System events. I'm trying to check if the source name is equal to "Windows Agent" or if the EventId is equal to 21. Which would indicate that the computer needs a restart. But I don't get any result and there is without a doubt such an entry in the event log.
oid DisplayEntries( )
{
HANDLE h;
EVENTLOGRECORD *pevlr;
BYTE bBuffer[BUFFER_SIZE];
DWORD dwRead, dwNeeded, cRecords, dwThisRecord;
int counter=0;
h = OpenEventLog( NULL,
"System");
if (h == NULL)
{
Form1->msg = Form1->msg.sprintf("Could not open the Application event log.");
Form1->Memo2->Lines->Add(Form1->msg);
}
pevlr = (EVENTLOGRECORD *) &bBuffer;
GetOldestEventLogRecord(h, &dwThisRecord);
while (ReadEventLog(h,
EVENTLOG_FORWARDS_READ |
EVENTLOG_SEQUENTIAL_READ,
0,
pevlr,
BUFFER_SIZE,
&dwRead,
&dwNeeded))
{
while (dwRead > 0)
{
printf("%02d Event ID: 0x%08X ",
dwThisRecord++, pevlr->EventID);
printf("EventType: %d Source: %s\n",
pevlr->EventType, (LPSTR) ((LPBYTE) pevlr +
sizeof(EVENTLOGRECORD)));
if ((LPSTR)((LPBYTE) pevlr + sizeof(EVENTLOGRECORD))=="Windows Agent")
{
MessageBox(NULL, "FOUND", "INFO",MB_OK);
}
dwRead -= pevlr->Length;
pevlr = (EVENTLOGRECORD *)
((LPBYTE) pevlr + pevlr->Length);
}
pevlr = (EVENTLOGRECORD *) &bBuffer;
}
CloseEventLog(h);
}
Many Thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
The first error lies in the following line
if ((LPSTR)((LPBYTE) pevlr + sizeof(EVENTLOGRECORD))=="Windows Agent")
What you are performing is a pointer comparison with a static string. This is only going to work in two ways
if the expression (LPSTR)((LPBYTE) pevlr + sizeof(EVENTLOGRECORD)) is used to initialise a string class like std::string or CString etc
a more straight forward way is to use a string compariosn function eg strcmp or its wide equivalent if you have a Unicode project.
i.e.
if(strcmnp((LPSTR)((LPBYTE) pevlr + sizeof(EVENTLOGRECORD)),"Windows Agent") == 0)
The other problem you might face is user priveledge as access to a system resource like the event logs may be restricted if you are not an Admin user.
|
|
|
|
|
I have a program(.exe).I want to know which actions it did when it running.
How can I explore such tasks?
Thank you.
GOOD LUCK.
|
|
|
|
|
What do you want to do exactly ? Define what you mean by 'action'.
|
|
|
|
|
Really,I have a iPod MP4 player.
I want to program a small tool to update new mp4/mp3 file.
The MP4 player has a additional tool,it can do it well.The tool change the file(which you want to update) name as a four characters long new name and map the file path and original name in a database file.
I want to do it by myself and imitate such task.
But I do not know the format of the database file and also do not know how to make a map in the database.
Would you like to give me a guide?Thanks.
GOOD LUCK
|
|
|
|
|
Can you more explain about your program and what do you want which actions?
|
|
|
|
|
Really,I have a iPod MP4 player.
I want to program a small tool to update new mp4/mp3 file.
The MP4 player has a additional tool,it can do it well.The tool change the file(which you want to update) name as a four characters long new name and map the file path and original name in a database file.
I want to do it by myself and imitate such task.
But I do not know the format of the database file and also do not know how to make a map in the database.
Would you like to give me a guide?Thanks.
GOOD LUCK
|
|
|
|
|
Add debug output using OutputDebugString to record what has happened.
User the Windows tool ProcessExplorer to examine File handles events etc that the exe is performing.
|
|
|
|
|
Hello to all,
right now i am trying to upload a file on the server in VC++(MFC), currently i can upload a file directly on the server but i want to upload a file in a perticular folder on the server that i am unable to do, bcoz whenever i add that folder name to the our server address in the code then after execution i get a message "server name or address can not be resolved" and so connetion with server can not be done. I am using CInternetSession and CFtpConnection classes and GetFtpConnection(),PutFile() and GetFile() functions of these classes for uploading and downloading. can anybody help me?
Anay Kulkarni
|
|
|
|
|
I believe you should add it to the 'pstrRemoteFile' parameter of the PutFile() / GetFile() calls instead of to the server address. Instead of asking for
myfile.txt
ask for
subdir1/subdir2/myfile.txt
See if that works for you.
|
|
|
|
|
yes, it worked fine. thanks a lot sir.
Anay
|
|
|
|
|
Are you calling the connection's SetCurrentDirectory() method before PutFile() ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I use VC2005.I found a new error I have never met before.
error C2220: warning treated as error - no 'object' file generated
How should I fixed it ?
Thanks.
GOOD LUCK
|
|
|
|
|
Try checking this[^] out.
Steve
|
|
|
|
|
kcynic wrote: How should I fixed it ?
Start by reading this.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|