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?
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:
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.
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.
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.
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 :):
Here are some related questions although you probably already saw them when you searched this site before posting:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With