The MASM Forum

General => The Campus => Topic started by: Don57 on October 06, 2012, 02:09:17 AM

Title: Running exe from inside of program
Post by: Don57 on October 06, 2012, 02:09:17 AM
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.
Title: Re: Running exe from inside of program
Post by: jj2007 on October 06, 2012, 02:21:36 AM
invoke WinExec, chr$("testthis.bat"), SW_SHOW

(There are more complicated solutions, too)
Title: Re: Running exe from inside of program
Post by: Don57 on October 06, 2012, 02:26:05 AM
Thank you. I'm interested in other solutions as well, because I don't want the DOS windows to show.
Title: Re: Running exe from inside of program
Post by: jj2007 on October 06, 2012, 02:37:46 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...).
Title: Re: Running exe from inside of program
Post by: Vortex on October 06, 2012, 03:33:59 AM
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?
Title: Re: Running exe from inside of program
Post by: Don57 on October 06, 2012, 04:20:13 AM
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.
Title: Re: Running exe from inside of program
Post by: Vortex on October 06, 2012, 04:34:01 AM
This vbs script clears the Application log without displaying a console :
Code: [Select]
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
Title: Re: Running exe from inside of program
Post by: hfheatherfox07 on October 08, 2012, 06:54:11 PM
@ 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----
Title: Re: Running exe from inside of program
Post by: sinsi on October 08, 2012, 10:10:45 PM
>There is no way to delete this log from the event viewer
Right-click, clear log
Title: Re: Running exe from inside of program
Post by: Don57 on October 09, 2012, 04:33:37 AM
I am runninng windows 7 64 bit and the clear log option is nowhere to be found for the administrators log.
Title: Re: Running exe from inside of program
Post by: Vortex on October 09, 2012, 04:38:22 AM
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
Title: Re: Running exe from inside of program
Post by: Don57 on October 09, 2012, 01:39:27 PM
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.