![]() |
microsoft log parser und delphi
hi,
ich möchte den log parser (COM) in delphi verwenden. kann mir bitte jemand folgendes erklären: - wie lade ich eine dll? - wie greife ich auf die funktionen der dll zu? - was muss man noch beim arbeiten mit dlls beachten? thx |
Re: microsoft log parser und delphi
Das meinst du wohl nicht ernst oder ?
Dir ist schon bewusst, dass es (Delphi) Tutorials (zu fast allen Themen) wie Sand am Meer gibt ? Da ich nicht nur negativ wirken möchte, hier ein Link: ![]() ![]() MfG |
Re: microsoft log parser und delphi
Du musst nicht die Funktionen einer DLL nutzen, sondern das ActiveX Control in Delphi importieren, wenn ich das richtig sehe. Die entsprechende Funktion findet sich im Menü Component bzw. Komponente, wie er dort genau heißt hängt von der Delphiversion ab.
|
DP-Maintenance
Dieses Thema wurde von "SirThornberry" von "Programmieren allgemein" nach "Sonstige Fragen zu Delphi" verschoben.
|
Re: microsoft log parser und delphi
so wie jaenicke gemeint hat, glaube ich, dass man die ActiveX importieren muss, jedoch bekomme ich eine Fehlermeldung: "Fehler beim Zugriff auf OLE-Registrierung."
ich verwende D2007 und Vista. habe versucht vorher mit regsvr32 LogParser.dll bringt aber auch nichts... kann bitte jemand weiterhelfen? Danke! |
Re: microsoft log parser und delphi
bin ein bißchen weitergekommen:
unter Vista sollte die dll nicht in das "Programme" Verzeichnis stehen, weil das die Fehlerquelle war. es wurde jetzt ein wrapper unit erstellt. werde versuchen es zu verwenden. |
Re: microsoft log parser und delphi
Liste der Anhänge anzeigen (Anzahl: 2)
habe jetzt den wrapper aber komme nicht dahinter wie ich es verwenden kann.
ich würde den log parser in den interactive mode verwenden. dafür habe ich in der hilfe datei folgendes gefunden: ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Interactive Mode Queries executed in interactive mode do not use output formats, but rather return their output records directly to the application. Interactive mode is useful when we want to execute a query and receive the output records for custom processing. A query is executed in interactive mode by calling the Execute method of the MSUtil.LogQuery object. This method takes two arguments: The text of the SQL-Like query; An input format object. The Execute method returns a LogRecordSet object. The LogRecordSet object is an enumerator of LogRecord objects; it allows an application to navigate through the query output records. Each LogRecord object represents a single query output record, and it exposes methods that can be used to retrieve individual field values from the output record. The basic steps of an application using interactive mode are: 1) Instantiate the MSUtil.LogQuery object; 2) Instantiate the input format object corresponding to the input format chosen for the query; 3) If needed, set input format object properties to change the default behavior of the input format; 4) Call the Execute method of the MSUtil.LogQuery object, specifying the query text and the input format object, and receiving a LogRecordSet object; 5) Enter a loop that uses the atEnd, getRecord, and moveNext methods of the LogRecordSet object to enumerate the LogRecord query result objects; 6) For each LogRecord object, access its field values using the getValue method of the LogRecord object, and process the field values as needed; 7) When finished, dispose of the LogRecordSet object by calling its close method. The following examples show a simple application parsing an IIS web site's logs and printing the output records to the console output. After instantiating the main MSUtil.LogQuery object, the application instantiates the MSUtil.IISW3CInputFormat input format object, which implements the IISW3C input format. Then, the application calls the Execute method of the MSUtil.LogQuery object, specifying the query and the input format object, and receiving the resulting LogRecordSet object. The LogRecordSet object is used in a loop to enumerate the LogRecord objects implementing the query output records; the application retrieves the first field from each LogRecord object and prints it to the console output. Finally, the application disposes of the LogRecordSet object by calling its close method.
Delphi-Quellcode:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Dim oLogQuery
Dim oIISW3CInputFormat Dim strQuery Dim oRecordSet Dim oRecord Dim strClientIp Set oLogQuery = CreateObject("MSUtil.LogQuery") ' Create Input Format object Set oIISW3CInputFormat = CreateObject("MSUtil.LogQuery.IISW3CInputFormat") ' Create query text strQuery = "SELECT c-ip FROM <1> WHERE cs-uri-stem LIKE '%hitcount.asp'" ' Execute query and receive a LogRecordSet Set oRecordSet = oLogQuery.Execute ( strQuery, oIISW3CInputFormat ) ' Visit all records DO WHILE NOT oRecordSet.atEnd ' Get a record Set oRecord = oRecordSet.getRecord ' Get first field value strClientIp = oRecord.getValue ( 0 ) ' Print field value WScript.Echo "Client IP Address: " & strClientIp ' Advance LogRecordSet to next record oRecordSet.moveNext LOOP ' Close RecordSet oRecordSet.close meine Fragen jetzt: 1) ich brauche folgende Variablen:
Delphi-Quellcode:
brauche ich noch etwas um auf die ergebnisse der query zuzugreifen?
LogQ: ILogQuery; //die eigentliche Query
LogInterface: IInterface; // welches Input Format benötigt wird LogRecSet: ILogRecordset; // die Antwort der Query als RecordSet LogRec: ILogRecord; // je ein Record aus RecordSet 2) erzeuge ich die objekte richtig?
Delphi-Quellcode:
3) wie rufe ich richtig die LogQuery.Execute auf?
procedure TForm1.FormCreate(Sender: TObject);
begin LogQ := Create(ILogQuery); LogRecSet := Create(ILogRecordset); LogRec := Create(ILogRecord); end; vor allem der 2.te parameter verstehe ich nicht ganz.
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin LogRecSet := LogQ.Execute(Memo1.Text, ???); end; danke! |
AW: microsoft log parser und delphi
Delphi-Quellcode:
var
iLog : ILogQuery; iEventLog : ICOMEventLogInputContext; iRS : ILogRecordset; iRecord : ILogRecord; str : string; procedure TForm1.Button1Click(Sender: TObject); begin iLog := CoLogQueryClass.Create; iRS := iLog.Execute('SELECT * FROM Security', iEventLog); while not iRS.atEnd do begin iRecord := iRS.getRecord; str := iRecord.getValue('TimeGenerated'); Memo1.Lines.Add(str); str := iRecord.getValue(1); Memo1.Lines.Add(str); //... end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:01 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz