I wrote a small batch file to erase the windows event logs, of which there are many. I want to place the executable inside a GUI interface.
I essence have the programrun from a GUI interface.
invoke WinExec, chr$("testthis.bat"), SW_SHOW
(There are more complicated solutions, too)
Thank you. I'm interested in other solutions as well, because I don't want the DOS windows to show.
Quote from: Don57 on October 06, 2012, 02:26:05 AM
I don't want the DOS windows to show.
Use SW_HIDE (but beware of hanging DOS apps - for testing, I would use SW_MINIMIZE; besides, some minimal feedback to the user is not necessarily a bad thing...).
Hi Don57,
What's wrong with the Windows Event Log Functions?
http://msdn.microsoft.com/en-us/library/windows/desktop/aa385784(v=vs.85).aspx
Another question : why do you wish to delete the events silently?
I load and test various OS's and programs on my computer, as a result things go bad sometimes, and the Adminstrators log keeps building. There is no way to delete this log from the event viewer, so this was my solution.
This vbs script clears the Application log without displaying a console :
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Backup)}!\\" & _
strComputer & "\root\cimv2")
Set colLogFiles = objWMIService.ExecQuery _
("SELECT * FROM Win32_NTEventLogFile WHERE LogFileName='Application'")
For Each objLogfile in colLogFiles
objLogFile.ClearEventLog()
Next
@ Don57
Here is an example that I did not even remember having ....
It creates a batch files and than deletes it ...you never see a dos window :biggrin:
you can modify the batch file to delete your log
----EDIT----
>There is no way to delete this log from the event viewer
Right-click, clear log
I am runninng windows 7 64 bit and the clear log option is nowhere to be found for the administrators log.
Hi Don57,
Could you please check the links below?
http://www.learnwithnirab.com/2011/10/how-to-clear-event-viewer-log-in.html
http://www.thewindowsclub.com/how-to-view-and-delete-event-viewer-saved-logs-in-windows-7
Thanks. :t The first one I already knew, but the second one that path doesn't exist in my version of windows 7 64x Ultimate
C:\ProgramData\Microsoft\Event Viewer\ExternalLogs no ExternalLogs
The only problem is the Administrative Events log, with no clear function. With help from the forum putting together a little app to do that. If I have some free time next weekend I should finish it. I'd rather have it in an exe than a batch file so I can't alter it accidently.