Solved

Get Size of Event Viewer Log

Posted on 2004-10-13
4
166 Views
Last Modified: 2010-05-02
I'm writing to the event viewere using App.LogEvent. Does anyone know how I can check the size of the application log in the event viewer?

Thanks in advance
0
Comment
Question by:LeeHenry
  • 2
4 Comments
 
LVL 4

Expert Comment

by:AjithJose
ID: 12311077
You can specify the size in the registry under the event log entries. For
instance to change the size of the app log you would change the key

hkey_local_machine\system\currentcontrolsset\services\eventlog\application\MaxSize

Which is a DWORD

you can set it from VB using windows registry API
0
 
LVL 28

Accepted Solution

by:
vinnyd79 earned 400 total points
ID: 12364961
Have you tried using FileLen?

Private Const MAX_PATH = 260
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Private Sub Command1_Click()
Dim strBuff As String, strSysDir As String
strBuff = Space$(MAX_PATH)

GetSystemDirectory strBuff, MAX_PATH
strSysDir = Left$(strBuff, InStr(strBuff, Chr$(0)) - 1)

MsgBox FileLen(strSysDir & "\Config\AppEvent.evt")

End Sub
0
 
LVL 6

Author Comment

by:LeeHenry
ID: 12374185
Thanks vinnyd!
I can work with this.
Is there a way I can check the maximum file size that was set on the eventviewer?

If not I can use your input, and specify my own file size to make sure it doesn't go over..


Thanks.
0
 
LVL 4

Assisted Solution

by:AjithJose
AjithJose earned 100 total points
ID: 12374495

Check the key: hkey_local_machine\system\currentcontrolsset\services\eventlog\application\MaxSize

Which is a DWORD

you can get it from VB using windows registry API
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Input past end of file vbs script 9 82
Access 2016 VB code 9 103
VBA filters 2 50
How to hault or freeze parent form when a 2d form is open in vb6 3 36
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now