Solved

Get Size of Event Viewer Log

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

758 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

20 Experts available now in Live!

Get 1:1 Help Now