Good morning, I wish everybody have a great day. In this short articles I will write about making an simple “watchdog” application. 14 days ago I need to stabilize an bug application. The bug is really annoying , My application have memory leak each seconds timer fired. This is a bug from VbMySql direct and ODBC MySql Connector, My options to raised physical memory is not approved because application will consume more and more memory without limitation. My second options is writing a new application but it will take more than a month working so I stay with this buggy application and prevent it from error.
I found out when programs closed windows releases all memory this application used, I try to make something to kill an application each 1 hours to release the memory, It’s works!.. Now I need to make an application to auto restarting my program each time it’s killed. Searching on Google then I found sample interesting code.
Dim objWMIService, colProcesses
Dim Process As String
Process = “YOURPROCESS”
Set objWMIService = GetObject(“winmgmts:”)
Set colProcesses = objWMIService.ExecQuery(“Select * from Win32_Process where name='” & Process & “‘”)
If colProcesses.Count Then
MsgBox (“Process is Running”)
MsgBox (“Process is Not Running”)
It was basic watchdog application, It will check when the process not running on computer background. You can be more creative by adding timer or when this code will fired. With this application I got my buggy application running 99,9% from 100%.
That’s share for today, Have a nice day 😀
If you're new here, you may want to subscribe to my RSS feed. You may copy or publish this article to your blog or other site as long you give credit link back to this site article. Thanks for visiting my blog!