473,320 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

GetProcessesByName XP SP2 Bug?

JZ
Hi,

Has anyone else got this?
I've downloaded the IT Professional network version of XP SP2 to test my
programs.

I found a problem with GetProcessesByName it just seems to hang.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim processes() As Process
processes = Process.GetProcessesByName("MyProgram")
MessageBox.Show("Done!")

End Sub

Anybody?

Ideas?

Suggestions?

--
JZ
Nov 21 '05 #1
4 1674
* "JZ" <jj@anon.anon.com> scripsit:
Has anyone else got this?
I've downloaded the IT Professional network version of XP SP2 to test my
programs.

I found a problem with GetProcessesByName it just seems to hang.


I suggest to post this question to one of the Whidbey groups:

<URL:http://communities.microsoft.com/newsgroups/default.asp?icp=whidbey>

Infos on how to view these groups with an NNTP news client:

<URL:http://communities.microsoft.com/newsgroups/ICP/whidbey/US/welcomePage.htm>

If you are sure that this is a bug, use MSDN Product Feedback Center to
report it:

<URL:http://lab.msdn.microsoft.com/productfeedback/>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2
JZ
Hi,

These links are for VS 2005.

My problem was with Windows XP Service pack 2.
As I didn't have the problem until I installed it.

--
JZ
Nov 21 '05 #3
JZ
Hi,

I'm not sure whether it is XP SP2, it might just be my PC.

However, just in case anyone else is reading this, I found a work around for
what I needed to do...

Dim appMutex As New System.Threading.Mutex(False, "MyApplicationName")
If appMutex.WaitOne(0, False) Then
'Application.Run(New MyMainForm())
Else
MessageBox.Show _
("Can not start because a previous instance of this application is
already running.")
End If

--
JZ
Nov 21 '05 #4
Your code is a lot like what I am using, but I noticed you are not releasing
your mutex. Not even sure of the ramifications of that, but here is what I
use...

HTH,
Greg

' code to start app...
Try
SingletonApp.Run(New MyMainForm, "8ca35a66-6e9a-41d4-a87d-d9755b1f88c4") '
arbitrary GUID
Catch ex As SingletonException
MsgBox("Can not start because a previous instance of this application is
already running!")
End Try

' code inside singletonapp.vb file
Option Strict On

Imports System.Threading

Public Class SingletonApp

Private Shared _guid As String

Shared m_Mutex As Mutex
Public Shared Sub Run(ByVal mainForm As Form, ByVal guid As String)
_guid = guid
If (IsFirstInstance()) Then
AddHandler Application.ApplicationExit, AddressOf OnExit
Application.Run(mainForm)
Else
Throw New SingletonException
End If
End Sub
Public Shared Function IsFirstInstance() As Boolean
m_Mutex = New Mutex(False, _guid)
Dim owned As Boolean = False
owned = m_Mutex.WaitOne(TimeSpan.Zero, False)
Return owned
End Function

Public Shared Sub OnExit(ByVal sender As Object, ByVal args As
EventArgs)
m_Mutex.ReleaseMutex()
m_Mutex.Close()
End Sub
End Class

Public Class SingletonException

Inherits System.ApplicationException

Public Sub New()
MyBase.New("Program already running!")
End Sub

Public Sub New(ByVal InnerException As Exception)
MyBase.New("Program already running!", InnerException)
End Sub

End Class
"JZ" <jj@anon.anon.com> wrote in message
news:41***********************@news.dial.pipex.com ...
Hi,

I'm not sure whether it is XP SP2, it might just be my PC.

However, just in case anyone else is reading this, I found a work around for what I needed to do...

Dim appMutex As New System.Threading.Mutex(False, "MyApplicationName")
If appMutex.WaitOne(0, False) Then
'Application.Run(New MyMainForm())
Else
MessageBox.Show _
("Can not start because a previous instance of this application is
already running.")
End If

--
JZ

Nov 21 '05 #5

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

Similar topics

0
by: Peter Stojkovic | last post by:
I call GetProcessesByName( myApplictaionName) to test wether an old application-instance of my software is running. Then always my disk-drive runs a short time The program and...
0
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...
2
by: Hans | last post by:
I am using Process.GetProcessesByName("SomeName") in my app and it workes on most windows platforms. On most - it does not work in a terminal server session on a Windows 2003 server. Although the...
5
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...
5
by: Lord Fonty | last post by:
Hi All I posted this recently and no one responded so I am wondering if there are any guru's out there whould could help me: > I keep getting the above message when using >...
3
by: Steve Long | last post by:
Hello, I'm using the Process class to get all the current running processes on my machine and looking for a particular process. If I find the process, I want to kill it. However, I've recently...
5
by: Andy | last post by:
Hi all, Just started having a problem with this. It seems now that GetProcessesByName will block for about 10-15 seconds before returning. It never happened before, this is a recent...
4
by: Samuel R. Neff | last post by:
Most of the time what I've read is that to keep only one instance of an app running one should use a Mutex. However, we have an existing app that uses GetProcessByName() to ensure only one...
2
by: kd | last post by:
Hi All, Process.GetProcessesByName() is not giving the expected results. Here is a sample code. Dim TestProcess() As Process Try TestProcess= Process.GetProcessesByName("Test.exe") If...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.