Hello,
Is there an API I can use to detect windows processes? For example, if I were to run notepad.exe, and I wanted to pop a message up in my program that said "notepad.ex e" is running? How would I do that?
The real reason I want to do this is because I don't want my program interrupting me if certain programs are running, so if media player is running, I want my program to detect wmplayer.exe or whatever and disable itself.
Thanks!
2 2855
Time to use your friends (yahoo, google, ask, answers, bing) for your needs as there are many examples out there including more than one at PSC (planet-source-code)...
Good Luck
Umm thanks? Ok to those of you who want to know how to do this, here is a little program I wrote when I found out how to do it. -
Dim WinProcesses() As String
-
Dim WinProc As Object
-
Dim WinProcSet As Object
-
Dim WinProcCount As Long
-
Dim CheckLoop As Long
-
Private Sub cmdnotepad_Click()
-
GetProcesses
-
For CheckLoop = 1 To WinProcCount
-
If WinProcesses(CheckLoop) = "notepad.exe" Then
-
MsgBox "Notepad is running!"
-
Exit Sub
-
End If
-
Next CheckLoop
-
MsgBox "Notepad is not running!"
-
End Sub
-
Private Sub GetProcesses()
-
WinProcCount = 0
-
'Count the processes to redim the array
-
Set WinProcSet = GetObject("WinMgmts:").execquery("select * from Win32_process")
-
For Each WinProc In WinProcSet
-
WinProcCount = WinProcCount + 1
-
Next
-
-
'Create the process list in an array
-
ReDim WinProcesses(1 To WinProcCount) As String
-
WinProcCount = 0
-
For Each WinProc In WinProcSet
-
WinProcCount = WinProcCount + 1
-
WinProcesses(WinProcCount) = WinProc.Name
-
Next
-
End Sub
-
If it's possible to check an array for a value without running a processor unfriendly loop, I'd like to know that if you don't mind.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: bill ramsay |
last post by:
Dear all.
I am using an existing hodge-podge of an application that runs on top
of an Access database. This application dials up customer equipment,
handshakes then downloads/uploads various bits of information in the
access database.
The original application is designed for some poor sod to sit there
for hours and manually do the necessary.
|
by: Chris Dunaway |
last post by:
I'm writing an app that processes orders for various customers. For
most customers, the processing is the same. However, a few customers
require custom processing in addition to the standard processing that
is performed on all orders.
To accomplish this, I have created an interface and for the sake of
this question, it's only method is called SpecialProcess. For each
customer that requires special processing, I create a separate...
|
by: News Admin |
last post by:
I have a bunch of classes, instances of which that need to live in shared
memory and be accessed by multiple processes. This means that they cannot
have a vtable as the addresses in it will be in the address space of the
process that originally created the shared memory and therefore unavailable
to the other processes that may wish to use these instances of the classes.
Every so often I forget this and introduce a virtual function causing...
|
by: Aarti |
last post by:
I have written a windows service that needs to perform certain functions only if a User is logged in. The problem I am running into is that I get an error if the computer is in the process of being shut down or restarted. At all other times, the service runs just fine.
I need to either detect a logon/logoff event OR check somehow as to whether there is currently a valid logged on user. The closest I have found is ManagementEventWatcher...
|
by: bamapookie |
last post by:
I've written an app that starts and monitors a number of processes. If
one of those processes dies, the app restarts it. One of the options
I've written hides the main window of the monitored process (since
there are 99 processes, I'm trying to keep the screen clutter to a
minimum). Basicly, I start the app, then minimize, maximize, show, or
hide it based on the option chosen. My problem comes with the actual
app I'm monitoring. It...
| |
by: bamapookie |
last post by:
I'm sorry if this was posted several times. I did not see my previous
post appear after I posted it.
I've written an app that starts and monitors a number of processes. If
one of those processes dies, the app restarts it. One of the options
I've written hides the main window of the monitored process (since
there are 99 processes, I'm trying to keep the screen clutter to a
minimum). Basicly, I start the app, then minimize, maximize,...
|
by: pmclinn |
last post by:
I have a couple spyware bots I loaded on a test machine. While I was
watching the spyware infect the system I noticed that it was launching
a process but it was not listed in my task Managaer under processes. I
know the process is running because the firewall is detecting it. Does
anyone have code to list these invisble processes?
-Peter
|
by: BD |
last post by:
Hi, all.
I'm running 8.2 on Windows.
This is a development platform for a project whose production
environment is running on a mainframe.
I believe that the RI compilation process is not quite as robust on
Windows as it is in other environments. Here's what I'm finding:
|
by: Ilias Lazaridis |
last post by:
How to detect memory leaks of python programms, which run in an
environment like this:
* Suse Linux 9.3
* Apache
* mod_python
The problem occoured after some updates on the infrastructure. It's
most possibly caused by trac and it's dependencies, but several
components of the OS where updated, too.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |