[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to start application when windows start

Posted on 2002-04-29
6
Medium Priority
?
179 Views
Last Modified: 2010-05-02
hi!

I want to start my application when windows start... i guess it must be possbile by manipulation registry


thanks in advance


nachiket
0
Comment
Question by:nachiket
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:n_narayanan
ID: 6979722
You are right,

Here is the code for you,

 Needs a reference to the project "Windows Script Host Object Model" WSHOM.OCX
Public Sub EnableStartup()
    Dim cPGM As String
    Dim oShell As IWshRuntimeLibrary.IWshShell, frmMsgBox As frmMessageBox
    On Error GoTo ErrEnablestartup
    Set oShell = New IWshRuntimeLibrary.IWshShell_Class
   
   
    cPGM$ = App.Path & "\pmsg.exe"
    oShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\PMSG", cPGM, "REG_SZ"
    Set oShell = Nothing
    Exit Sub
ErrEnablestartup:
    Dim strErr As String
    strErr = "Err no:" & Err.Number & " Err Desc:" & Err.Description & " Module:Global Proc:EnableStartup " & " Sts:Continue Process " & Date & " " & Time
    Call ErrorLog(strErr)
End Sub

'Where PMSG.EXE is your application name
0
 
LVL 4

Author Comment

by:nachiket
ID: 6979726
thanks for the help i will try this and come back in 2 hours
0
 
LVL 4

Author Comment

by:nachiket
ID: 6979951
hi

thanks for the help and it worked... can i ask for one more favor?? please!!!

after runnig this code one key is added in HKLM\Software\Microsoft\Windows\CurrentVersion\Run\PMSG which start the application successfully on windows startup... but the problem is suppose now i have added the program to startup and i want to disble this feature after words than??? i mean after i have once added the program to windows startup and i want to remove it afterwords than how to do that?

thank u very much for the help..  waiting.....

nachiket
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Expert Comment

by:n_narayanan
ID: 6979991
I will put the code in few Mins.

Your points for this is very less!!!

Just joking...

Narayanan
0
 
LVL 3

Accepted Solution

by:
n_narayanan earned 400 total points
ID: 6979994
Call this function

Public Sub DisableStartup()
    Dim oShell As IWshRuntimeLibrary.IWshShell_Class, frmMsgBox As frmMessageBox
    On Error GoTo ErrDisableStartup
    Set oShell = New IWshRuntimeLibrary.IWshShell_Class
 
    oShell.RegDelete "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\PMSG"
    Set oShell = Nothing
    Exit Sub
ErrDisableStartup:
    Resume Next
End Sub

Narayanan
0
 
LVL 3

Expert Comment

by:sridhar_PJ
ID: 6980004
Learning
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month18 days, 13 hours left to enroll

834 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