Solved

Get Size of Event Viewer Log

Posted on 2004-10-13
4
176 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

685 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