Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Process monitor / dispatcher in VB6

Tags:

windows-xp

vb6

I need to write a little application in VB6 to run instances of another VB6 application and keep an eye on the running processes, but I don't have any idea how to get process information in VB6. I can see some of what I need with the tasklist utility but I don't really know how create processes (specifying the process or application name if possible) and fetching information about processes from the operating system.

This application is to run on a Windows XP machine.

Does anyone know of a get-you-started tutorial or helpful web page for this sort of thing?

like image 929
Brian Hooper Avatar asked Jun 17 '11 11:06

Brian Hooper


People also ask

What is the dispatcher in a scheduler?

When the scheduler completes its job of selecting a process, it is the dispatcher which takes that process to the desired state/queue. The dispatcher is the module that gives a process control over the CPU after it has been selected by the short-term scheduler. This function involves the following:

What is dispatcher in Linux?

Dispatcher is a module that gives control of CPU to the process selected by short term scheduler. Scheduler is something which selects a process among various processes. Types: There are no different types in dispatcher.It is just a code segment. There are 3 types of scheduler i.e. Long-term, Short-term, Medium-term.

How do I use process monitor on Windows Vista?

Process Monitor works on Windows Vista, Windows Server 2003, on Windows XP, and on Microsoft Windows 2000. To download, to install, and to run Process Monitor, follow these steps: To download Process Monitor, visit Process Monitor v3.60. Extract the ProcessMonitor.zip file on the computer that you want to monitor.

What is VB Watch Debugger?

VB Watch Debugger allows remote debugging at client site via TCP/IP. The instrumentation console allows you to batch process projects with predefined settings. VB Watch Console works together with VB Watch Profiler, Protector and Debugger. Run the Console to instrument one or more projects in a batch.


2 Answers

There are numerous Windows API functions you can use to do this. I'd start with looking at EnumProcesses (VB6 example and declaration here) which can be used to gather information about all running processes. You can also use OpenProcess to start interrogating Windows about a particular process (another VB6 example).

There is also a fairly nice example on MSDN.

And of course, there is CreateProcess (AllApi link) or ShellExecute (AllApi) for spawning processes - the former gives you more control over the creation of the process, while the latter is a much simpler call.

There was another question posted about this a while back with some example code.

Another possible approach would be to use WMI (some useful snippets to adapt).

Finally, here are some tutorials that show you how to do it (I'd recommend trying it yourself first though :):

  • Getting Process Information using PSAPI
  • Another EnumProcesses/OpenProcess implementation
  • WMI-based demonstration

Here are some related questions although you probably already saw them when you searched this site before posting:

  • Monitoring processes to see if they've crashed in vb6
  • How can I execute a .bat file but wait until its done running before moving on?
  • How To Enumerate Processes From VB 6 on Win 2003?
like image 129
mdm Avatar answered Sep 28 '22 01:09

mdm


Since you say the other application is ** also VB6**, it would be easier to make the other application into an ActiveX exe. Then you can get references to objects in the other application direct from your first application. COM solves it all for you.

  • Here's Microsoft's tutorial on the subject - you can download the code too.
  • Or here's another answer where I've written about this
like image 40
MarkJ Avatar answered Sep 28 '22 01:09

MarkJ