Solved

Get Size of Event Viewer Log

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…

839 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