Author Topic: Running exe from inside of program  (Read 5156 times)

Don57

  • Guest
Running exe from inside of program
« 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.

jj2007

  • Member
  • *****
  • Posts: 9792
  • Assembler is fun ;-)
    • MasmBasic
Re: Running exe from inside of program
« Reply #1 on: October 06, 2012, 02:21:36 AM »
invoke WinExec, chr$("testthis.bat"), SW_SHOW

(There are more complicated solutions, too)

Don57

  • Guest
Re: Running exe from inside of program
« Reply #2 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.

jj2007

  • Member
  • *****
  • Posts: 9792
  • Assembler is fun ;-)
    • MasmBasic
Re: Running exe from inside of program
« Reply #3 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...).

Vortex

  • Member
  • *****
  • Posts: 2030
Re: Running exe from inside of program
« Reply #4 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?

Don57

  • Guest
Re: Running exe from inside of program
« Reply #5 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.

Vortex

  • Member
  • *****
  • Posts: 2030
Re: Running exe from inside of program
« Reply #6 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

hfheatherfox07

  • Member
  • ***
  • Posts: 464
Re: Running exe from inside of program
« Reply #7 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----
« Last Edit: November 16, 2012, 04:04:37 AM by hfheatherfox07 »
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

sinsi

  • Member
  • *****
  • Posts: 1187
Re: Running exe from inside of program
« Reply #8 on: October 08, 2012, 10:10:45 PM »
>There is no way to delete this log from the event viewer
Right-click, clear log
I can walk on water but stagger on beer bourbon.

Don57

  • Guest
Re: Running exe from inside of program
« Reply #9 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.


Don57

  • Guest
Re: Running exe from inside of program
« Reply #11 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.