473,796 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Process.GetProc essesByName does not work as expected

kd
Hi All,

Process.GetProc essesByName() is not giving the expected results. Here is a
sample code.

Dim TestProcess() As Process
Try
TestProcess= Process.GetProc essesByName("Te st.exe")
If TestProcess.Len gth = 0 Then
MsgBox("Not running", MsgBoxStyle.OKO nly)
Else
MsgBox("Running ", MsgBoxStyle.OKO nly)
End If
Catch ex As Exception
MsgBox("Error!" )
End Try

"Not Running" is displayed, though Test.exe is running.

Would anybody be able to figure out why?

Thanks.
kd
Nov 21 '05 #1
2 19103
Yes, get rid of the ".exe". and only use "Test". Not sure if
capitalization makes a difference, but I know that the file suffix is not
returned by the GetProcessesByN ame function.
"kd" <kd@discussions .microsoft.com> wrote in message
news:C4******** *************** ***********@mic rosoft.com...
Hi All,

Process.GetProc essesByName() is not giving the expected results. Here is a
sample code.

Dim TestProcess() As Process
Try
TestProcess= Process.GetProc essesByName("Te st.exe")
If TestProcess.Len gth = 0 Then
MsgBox("Not running", MsgBoxStyle.OKO nly)
Else
MsgBox("Running ", MsgBoxStyle.OKO nly)
End If
Catch ex As Exception
MsgBox("Error!" )
End Try

"Not Running" is displayed, though Test.exe is running.

Would anybody be able to figure out why?

Thanks.
kd

Nov 21 '05 #2
kd

Eliminating the ".exe" fixed the problem.

Thanks Terry.
kd.

"Terry Olsen" wrote:
Yes, get rid of the ".exe". and only use "Test". Not sure if
capitalization makes a difference, but I know that the file suffix is not
returned by the GetProcessesByN ame function.
"kd" <kd@discussions .microsoft.com> wrote in message
news:C4******** *************** ***********@mic rosoft.com...
Hi All,

Process.GetProc essesByName() is not giving the expected results. Here is a
sample code.

Dim TestProcess() As Process
Try
TestProcess= Process.GetProc essesByName("Te st.exe")
If TestProcess.Len gth = 0 Then
MsgBox("Not running", MsgBoxStyle.OKO nly)
Else
MsgBox("Running ", MsgBoxStyle.OKO nly)
End If
Catch ex As Exception
MsgBox("Error!" )
End Try

"Not Running" is displayed, though Test.exe is running.

Would anybody be able to figure out why?

Thanks.
kd


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3563
by: rollasoc | last post by:
Hi, One of our customers seem to be having an issue with our software getting the following exception on running the app. 'System.InvalidOperationException', with the message "Process performance counter is disabled, so the requested operation cannot be performed." (System.Diagnostics.Process.GetProcessesByName() seems to be the function it
5
5434
by: hangten | last post by:
I have a service that 1) uses filewatcher to watch a directory on a remote machine. 2) checks if a certain application is running on the local machine before starting it. The problem is while checking for an existing instance of the application. I do the following code : Process processes = Process.GetProcessesByName(stProcName, localcpu); Where stProcName is the process I am checking localcpu is the local machine name.
2
4489
by: JerryW | last post by:
I just reinstalled .NET 2003 (after repeated attempts to get ASP.NET Web Applications to work). I created a new virtual directory from within IIS (e.g. WebTest). Then I tried to create a new Visual C# ASP.NET Web Application pointint to the location http://localhost/MyWebTest. I get an error: "The Web server reported the following error when attempting to create or open the Web project located at
7
960
by: JerryW | last post by:
I just reinstalled .NET 2003 (after repeated attempts to get ASP.NET Web Applications to work). I first did a complete uninstall of .NET 2003, .NET Framework 1.1, and IIS. I also completely deleted c:\inetpub\wwwroot and rebooted before reinstalling. I created a new virtual directory from within IIS (e.g. MyWebTest). Then I tried to create a new Visual C# ASP.NET Web Application pointing to the location http://localhost/MyWebTest. I get...
2
5420
by: rrossney | last post by:
Please look at the "what I've already done" section of this message before responding to it: I believe that I've done everything that the people who experience this error are typically told to do. I have created an ASP.NET web service that I have running on my development machine, and am trying to get it to run on my test server. Both machines are running Windows 2000 SP4, IIS 5, and the .NET 2.0 framework. When I attempt to access...
0
2903
by: Eric | last post by:
I'm trying to run a C# web service that I ported from VS 2003 to VS 2005. I'm unable to run it, I see: Failed to execute the request because the ASP.NET process identity does not have read permissions to the global assembly cache. Error: 0x80070005 Access is denied. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
4
8849
by: Steven De Smet | last post by:
Hello, This is my first post. I searched on the internet for answers but I was unable to solve my problem. So I hope that you guy's can help me with my VB.NET problem I tried to create a windows service that converts MS Word Files into .PDF files and after that we want to zip the .PDF files. Our code: Protected Overrides Sub OnStart(ByVal args() As String) ' Add code here to start your service. This method should set...
2
2620
by: djidan | last post by:
hello, can anyone tell what the hell is the problem with my program...? i built a program that getting all the process from windows by the name of "excel", when i compile it and creating a .exe file and start it on my comp, it's working perfectly, but when i tried to run it on en other computer it stops working with out telling me what exception throwed, but just telling that the program has to close and they are sorry for the inconvenience....
9
27639
by: erictheone | last post by:
Ok so what I'm trying to do is create a trans location cipher. For those among us that don't know alot about cryptography it is a method for jumbling up letters to disguise linguistic patterns(words). What it does is takes a string as a parameter, determines length of string, tests if the length is a perfect square, if it is then it makes a 2-d array with its length and height equal to the lengths root. If it isn't then it cuts it down to...
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10173
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,...
0
10006
tracyyun
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...
0
9052
agi2029
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...
1
7547
isladogs
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...
0
6788
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();...
0
5441
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...
1
4116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2925
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.