5 Replies - 290 Views - Last Post: 05 February 2012 - 07:24 AM Rate Topic: -----

Topic Sponsor:

#1 Bluezap  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 85
  • Joined: 19-January 12

Set Priority for a program

Posted 03 February 2012 - 02:43 AM

Hey
I would like to know how i can make my program execute just as the computer switches on.
I tried putting the program in the startup folder but it doesn't execute right as the desktop is loaded and takes about 10 secs to execute.
Is there a priority option or something that i am unaware of?
Is it possible to do this?
Is This A Good Question/Topic? 0
  • +

Replies To: Set Priority for a program

#2 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 67
  • View blog
  • Posts: 522
  • Joined: 21-December 11

Re: Set Priority for a program

Posted 03 February 2012 - 05:30 AM

i don't know for any priority option but you can do this by writing to registry.

Dim regKey As Microsoft.Win32.RegistryKey
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
Dim AppName As String = "YourAppName" & ".exe"
Dim AppPath As String = Application.StartupPath & "\" & AppName 
regKey.SetValue(AppName, AppPath)
regKey.Close()



to disable running at startup you must delete regKey:
                    regKey.DeleteValue(AppName, False)


Was This Post Helpful? 0
  • +
  • -

#3 Ionut  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 327
  • View blog
  • Posts: 914
  • Joined: 17-July 10

Re: Set Priority for a program

Posted 03 February 2012 - 06:25 AM

At the bottom of this page you will find the startup order in WindowsXP(for newer versions you have to make some compatibility tests).
Was This Post Helpful? 0
  • +
  • -

#4 Bluezap  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 85
  • Joined: 19-January 12

Re: Set Priority for a program

Posted 03 February 2012 - 08:54 PM

View Postsela007, on 03 February 2012 - 05:30 AM, said:

i don't know for any priority option but you can do this by writing to registry.

Dim regKey As Microsoft.Win32.RegistryKey
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
Dim AppName As String = "YourAppName" & ".exe"
Dim AppPath As String = Application.StartupPath & "\" & AppName 
regKey.SetValue(AppName, AppPath)
regKey.Close()



to disable running at startup you must delete regKey:
                    regKey.DeleteValue(AppName, False)



I created my program only to work on windows 7.So i need a good solid piece of code which will not fail.Are you certain that this coding will work on Windows 7 without any errors or failing?

View PostIonut, on 03 February 2012 - 06:25 AM, said:

At the bottom of this page you will find the startup order in WindowsXP(for newer versions you have to make some compatibility tests).

Thanks but i wrote my program only to work on windows 7.So i need help to get this done in windows 7
Was This Post Helpful? 0
  • +
  • -

#5 Ionut  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 327
  • View blog
  • Posts: 914
  • Joined: 17-July 10

Re: Set Priority for a program

Posted 04 February 2012 - 01:26 AM

Quote

I created my program only to work on windows 7.So i need a good solid piece of code which will not fail.Are you certain that this coding will work on Windows 7 without any errors or failing?

This is why you have to test your application before deployement. Plus, if you work with registry, you have to make sure you access the same keys on 32-bit and 64-bit Windows versions.

As I recall, services(as in any version of Windows) start first, so you might create a startup service that will load your application. This way your application starts at machine level(startup folder is defined by each user that logs on the computer) and the user needs administrator rights to disable it
Was This Post Helpful? 0
  • +
  • -

#6 Bluezap  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 85
  • Joined: 19-January 12

Re: Set Priority for a program

Posted 05 February 2012 - 07:24 AM

View PostIonut, on 04 February 2012 - 01:26 AM, said:

Quote

I created my program only to work on windows 7.So i need a good solid piece of code which will not fail.Are you certain that this coding will work on Windows 7 without any errors or failing?

This is why you have to test your application before deployement. Plus, if you work with registry, you have to make sure you access the same keys on 32-bit and 64-bit Windows versions.

As I recall, services(as in any version of Windows) start first, so you might create a startup service that will load your application. This way your application starts at machine level(startup folder is defined by each user that logs on the computer) and the user needs administrator rights to disable it


I am sorry but i dont know how to achieve this.How do i create a service to open my program as the computer starts up? I need a solid piece of coding to create this service on click (when the user clicks a command button i want that service to be created)
Any idea of how to do this? and i need to know how i can remove the service if the user decides to do so.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1