Solved

How to start application when windows start

Posted on 2002-04-29
6
168 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 100 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Modifying Conditional Format from VBA code 3 69
clicking a shape in a frame array vb6 3 48
Passing a Text Box name to a Sub 6 102
VBA: loop recent folder and copy txt file. 8 49
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

685 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