Link to home
Start Free TrialLog in
Avatar of nachiket
nachiket

asked on

How to start application when windows start

hi!

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


thanks in advance


nachiket
Avatar of n_narayanan
n_narayanan
Flag of India image

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
Avatar of nachiket
nachiket

ASKER

thanks for the help i will try this and come back in 2 hours
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
I will put the code in few Mins.

Your points for this is very less!!!

Just joking...

Narayanan
ASKER CERTIFIED SOLUTION
Avatar of n_narayanan
n_narayanan
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Learning