VB 6.0 - Process and Thread Related Samples

Enumerate All Processes Currently Running
On Win9x and Win2K machines it is a snap to enumerate all the processes running. Use CreateToolHelpSnapshot to create a snapshot of the processes then loop through the snapshot with the Process32First and Process32Next functions. On NT you need to use the functions available in PSAPI.dll.

Simulate Window's Alt-Tab List
List the applications running like Windows does when you press the ALT-TAB keys. Applications listed are those that appear on the taskbar.

Also see how to switch between applications and correctly bring an application to the foreground.

Determine if an Application has Stopped Responding
See if an application is hung or has stopped responding then kill it if is has.

Safely Stop a Running Process
The correct way to close another application from your program is to close all of the application's parent windows. Here's how.

Wait for a Process to Terminate
Start another program from your app and wait for it to end before processing your next instruction. The WaitForSingleObject API allows you to do this. You can even wait for DOS applications to finish.

Wait for a Process to Terminate with Windows Scripting Host
The Windows Scripting Host (WSH) lets you start an application and run it either asynchronously or modally. Call its Run method and tell it whether to wait for the application to terminate or not.

Start Control Panel Applets or Dial Up Networking,
Format Floppies, De-Brand Internet Explorer

Rundll32.exe lets you open Control Panel applets, launch Dial Up Networking and format floppy disks. You can also do this with Explorer.

Open/Print Files, View Web Sites, Connect to the Internet
Determine the application associated with a given file type then open or print the file with the associated application. Start your default browser and view a particular web site or pre-fill E-Mail fields such as To:, CC:, Subject:,...

See how to automatically dial the Internet and disconnect when you are done using the InternetAutodial and InternetAutodialHangup functions of Wininet.dll. Use the Microsoft Internet Control to web enable your apps.

Enumerate DUN connections and connect to the Internet
List your Dial-Up Networking (DUN) connections. Use the the Internetdial and InternetHangup functions of Wininet.dll to establish a DUN connection to the internet.

Pass Strings and Data Between VB Applications
Pass data from one VB app to another, without COM, even though the apps run in separate process spaces. The receiving app automatically detects and processes the data.

Perform Interprocess Commumication With DDEML
Transfer data between applications and send commands to another application using the Dynamic Data Exchange Management Library.




About TheScarms
About TheScarms


Sample code
version info

If you use this code, please mention "www.TheScarms.com"

Email this page


© Copyright 2024 TheScarms
Goto top of page