Meske
-
20 avril 2001 à 14:44
Renfield
Messages postés17287Date d'inscriptionmercredi 2 janvier 2002StatutModérateurDernière intervention27 septembre 2021
-
11 avril 2006 à 14:05
QQ sais comment on utililise ReadEventLog ??
pour lire dans le Evnet Log de NT ..
Un petit exemple de source par exemple ...
Je cherche de mon coté mais ca fait deux jours que je pietine ...
Merci d'avance
Tristan BAZIN
h = OpenEventLog( NULL, // use local computer
"Application"); // source name
if (h == NULL)
ErrorExit("Could not open the Application event log.");
pevlr = (EVENTLOGRECORD *) &bBuffer;
// Opening the event log positions the file pointer for this
// handle at the beginning of the log. Read the records
// sequentially until there are no more.
while (ReadEventLog(h, // event log handle
EVENTLOG_FORWARDS_READ | // reads forward
EVENTLOG_SEQUENTIAL_READ, // sequential read
0, // ignored for sequential reads
pevlr, // pointer to buffer
BUFFER_SIZE, // size of buffer
&dwRead, // number of bytes read
&dwNeeded)) // bytes in next record
{
while (dwRead > 0)
{
// Print the event identifier, type, and source name.
// The source name is just past the end of the
// formal structure.
fabieune92
Messages postés8Date d'inscriptionmardi 28 mars 2006StatutMembreDernière intervention11 avril 2006 10 avril 2006 à 16:58
Y a t-il un moyen de le faire en VB sans passer par une dll en C ou autre...
Via des API?
Un exemple simple serait genial: (avec les declaration et tout...)
Renfield
Messages postés17287Date d'inscriptionmercredi 2 janvier 2002StatutModérateurDernière intervention27 septembre 202174 11 avril 2006 à 12:15
il "suffit de" porter le code (le traduire) de C vers VB...
à coups de :
Private Declare Function CloseEventLog Lib "advapi32.dll" (ByVal hEventLog As Long) As Long
Private Declare Function OpenEventLog Lib "advapi32.dll" Alias "OpenEventLogA" (ByVal lpUNCServerName As String, ByVal lpSourceName As String) As Long
Private Declare Function ReadEventLog Lib "advapi32.dll" Alias "ReadEventLogA" (ByVal hEventLog As Long, ByVal dwReadFlags As Long, ByVal dwRecordOffset As Long, ByRef lpBuffer As EVENTLOGRECORD, ByVal nNumberOfBytesToRead As Long, ByRef pnBytesRead As Long, ByRef pnMinNumberOfBytesNeeded As Long) As Long