Join 118,655 VB.NET Programmers for FREE! Ask your question and get quick answers from experts. There are 892 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!
I've made a windows service for the purpose of creating backup's of certain files and directories automatically each day. The service is installed as automatic (so it starts after win startup) and i have an application which monitors the service through a system tray icon (so right-click on it you can start/stop/pause the service, change settings, etc).
Now i wanted after the setup some settings made that the control application (with system tray icon) is started at windows startup.
So, i thought, the best way is to write in the registry (HKEY_LOCAL_MACHINE->SOFTWARE->MICROSOFT->WINDOWS->CurrentVersion->Run) a value with the shortcut to the installed application. I wrote the code that after the installation the correct path was written in the registry.
Unfortunately, it didn't work. The weird thing was, that when i looked at the task manager, that the process was started, but i didn't see the system tray icon.
Well, i thought: the other solution, just create a shortcut to the application in the win startup folder. But when i did it so that the shorcut was automatically made after the install, it was the same result: process started, but no system tray icon.
The very weird thing was this: if i manually created a shortcut to the application after the installation, it did work.
So somebody else here have maybe experience with this?
I've made a windows service for the purpose of creating backup's of certain files and directories automatically each day. The service is installed as automatic (so it starts after win startup) and i have an application which monitors the service through a system tray icon (so right-click on it you can start/stop/pause the service, change settings, etc).
Now i wanted after the setup some settings made that the control application (with system tray icon) is started at windows startup.
So, i thought, the best way is to write in the registry (HKEY_LOCAL_MACHINE->SOFTWARE->MICROSOFT->WINDOWS->CurrentVersion->Run) a value with the shortcut to the installed application. I wrote the code that after the installation the correct path was written in the registry.
Unfortunately, it didn't work. The weird thing was, that when i looked at the task manager, that the process was started, but i didn't see the system tray icon.
Well, i thought: the other solution, just create a shortcut to the application in the win startup folder. But when i did it so that the shorcut was automatically made after the install, it was the same result: process started, but no system tray icon.
The very weird thing was this: if i manually created a shortcut to the application after the installation, it did work.
So somebody else here have maybe experience with this?
Hope this helps.
Make sure that you have:
CODE
Imports Microsoft.Win32
After that you can add the code. Put this in the FormClosing() Event.
CODE
Dim regkey As RegistryKey regkey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", True) If (runOnStartupToolStripMenuItem.Checked = True) Then ' Add the value in the registry so that the application runs at startup regkey.SetValue("Your Application Name", Application.ExecutablePath.ToString()) Else ' Remove the value from the registry so that the application doesn't start regkey.DeleteValue("Your Application Name", False) End If
This post has been edited by gbertoli3: 30 Jun, 2008 - 02:45 PM
gbertoli3, thanks for your answer, but i have that already. It writes the correct url path succesfully to the Run key in the registry.
I tried it with a normal windows application, and it worked perfectly. But when i try it with my current application, the process of the application seems to start (application started then?) but the system tray icon don't show up.
Same as creating a shortcut after setup automatically (the auto-created shortcut won't work (process started but no icon), but when i create manually a shortcut it works).
This post has been edited by nbarten: 30 Jun, 2008 - 11:46 PM
gbertoli3, thanks for your answer, but i have that already. It writes the correct url path succesfully to the Run key in the registry.
I tried it with a normal windows application, and it worked perfectly. But when i try it with my current application, the process of the application seems to start (application started then?) but the system tray icon don't show up.
Same as creating a shortcut after setup automatically (the auto-created shortcut won't work (process started but no icon), but when i create manually a shortcut it works).
Oh ok Do need anymore help with vb, vb.net, c#, c++, html, javascript, css?
I tried it with a normal windows application, and it worked perfectly. But when i try it with my current application, the process of the application seems to start (application started then?) but the system tray icon don't show up.
Same as creating a shortcut after setup automatically (the auto-created shortcut won't work (process started but no icon), but when i create manually a shortcut it works).
I tried it with a normal windows application, and it worked perfectly. But when i try it with my current application, the process of the application seems to start (application started then?) but the system tray icon don't show up.
Same as creating a shortcut after setup automatically (the auto-created shortcut won't work (process started but no icon), but when i create manually a shortcut it works).
How are you starting the process? (Please could you show how.) I'm thinking that they be a parameter missing.
Also are two parts? 1) The process 2) The application that monitor the process
Which is not starting?
This post has been edited by AdamSpeight2008: 2 Jul, 2008 - 08:24 AM
I tried it with a normal windows application, and it worked perfectly. But when i try it with my current application, the process of the application seems to start (application started then?) but the system tray icon don't show up.
Start the Task Manager after startup and check if the application's process is still running. If it isn't there, the system tray is missing because your app abruptly shut down.
I tried it with a normal windows application, and it worked perfectly. But when i try it with my current application, the process of the application seems to start (application started then?) but the system tray icon don't show up.
Start the Task Manager after startup and check if the application's process is still running. If it isn't there, the system tray is missing because your app abruptly shut down.
Well, that's the weird thing. The proces is still running, but i don't see the system tray icon... while i manually start the application, it works fine.