[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

code works on xp but not on vista

Posted on 2007-11-28
5
Medium Priority
?
391 Views
Last Modified: 2010-04-21
The following code (included in the program I'm attempting to upgrade) runs fine on xp, but not on Vista.

Public Sub CheckForExistingInstance()
        Try
            If System.Diagnostics.Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName).Length > 1 Then
                ActivatePreviousInstance(gsBWBackupTitle)

                End
            End If

        Catch
            MessageBox.Show(Err.Number, Err.Description)
           End Try
    End Sub

The error I get is - the error number = 5 and the description is "couldn't get process information from remote machine.."

any ideas?

Thanks!
0
Comment
Question by:stephaniem712
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 21

Accepted Solution

by:
mastoo earned 1500 total points
ID: 20367430
I assume the error is on this line:

System.Diagnostics.Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName)

GetProcesses takes elevated privileges you probably don't have on the vista box.  You're better off using the application framework's single instance (3.0 framework) or mutex to enforce a single instance.
0
 

Author Comment

by:stephaniem712
ID: 20396669
I found some code using the mutex object.  However, it also includes "process.getcurent process().processname".  I've read about the mutex object, but need some "basic" help with it if this is the route I should take.  Any more ideas out there?  Thanks!!
0
 
LVL 21

Expert Comment

by:mastoo
ID: 20397020
0
 

Author Closing Comment

by:stephaniem712
ID: 31411481
I found the info on the mutex object anf incorporated it in the code which appears to be working.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question