Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,839 members, 7,956,164 topics. Date: Monday, 23 September 2024 at 06:29 AM |
Nairaland Forum / Science/Technology / Programming / Writing Code That Starts Programs Automatically When The System Starts Up? (1645 Views)
Need Help On How To Create A Php Code Code That Will Reply My Chat When Am Offli / 100+ Java, JS & JSP Apps With Their Source Code That You Can Make Money With / Step-by-step Method Of Writing Contiki Programs (2) (3) (4)
Writing Code That Starts Programs Automatically When The System Starts Up? by davidtayo(m): 2:29pm On Mar 13, 2009 |
i would love to write code that starts programs automatically when the system starts up. i use C#. can any one help me? |
Re: Writing Code That Starts Programs Automatically When The System Starts Up? by dammytosh: 3:42pm On Mar 13, 2009 |
There are several ways but a very simple way is to create a shortcut to the main executable and drag and drop it in the "Startup" folder under "All programs". If done properly, that should solve ur problem. I hope that helps. |
Re: Writing Code That Starts Programs Automatically When The System Starts Up? by Kobojunkie: 4:15pm On Mar 13, 2009 |
You could use a WindowService application, but why do you not like using Google? @Poster On Microsoft Windows operating systems, a Windows service is a long-running executable that performs specific functions and which is designed not to require user intervention. Windows services can be configured to start when the operating system is booted and run in the background as long as Windows is running, or they can be started manually when required. They are similar in concept to a Unix daemon. Many appear in the processes list in the Windows Task Manager, most often with a username of SYSTEM, LOCAL SERVICE or NETWORK SERVICE, though not all processes with the SYSTEM username are services. The remaining services run through svchost.exe as DLLs loaded into memory. |
Re: Writing Code That Starts Programs Automatically When The System Starts Up? by GoodMuyis(m): 4:27pm On Mar 13, 2009 |
You guyz did not understand programming language He said in C# not in Windows, My Guy pls do the study this: you need a registry key such like: HKEY hKey; RegOpenKeyEx(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_SET_VALUE,&hKey ); RegSetValueEx(hKey, "Writing to the Registry Example",0,REG_SZ,(const unsigned char*)system,sizeof(system)); RegCloseKey(hKey); let that code be above your "return()" code. I hope u understand that ? Good |
Re: Writing Code That Starts Programs Automatically When The System Starts Up? by dammytosh: 5:18pm On Mar 13, 2009 |
GoodMuyis:eh yah, please teach us, Mr Programmer. The code u posted looks like a cSharp code right I hope the guy will come back to tell u that the solution he needs is not that complex. All he needs i guess is for his program written in C# to start automatically when windows start up. and what i posted initially will do it, i just retried now and it works cos i doubted if i know anything abt programming just as u suppose. But if it is a program that starts other (a third party )application at start up, then a windows service is your surest bet. The service does a process.start(ExecutableFileName) upon load. but the service must be installed and configured to start automatically when windows start. |
Re: Writing Code That Starts Programs Automatically When The System Starts Up? by GoodMuyis(m): 1:01pm On Mar 14, 2009 |
Great Mr.dammytosh I see you mention "process.start(ExecutableFileName)" pls give me the complete code instead of half function i dont see that as abuse but challenge and am ready to learn from other. And dont regard this as mocking Thanks |
Re: Writing Code That Starts Programs Automatically When The System Starts Up? by dammytosh: 2:00pm On Mar 14, 2009 |
GoodMuyis:regard as[i] mocking ke ?[/i] , tens of applications out there is enough to encourage me that i sabi at least the fundamentals of programming. as a matter of fact i am posting this from an on going training session for the latest application i deployed. Ok, let me get serious, What i am saying is create a windows service that starts automatically on system start up. (u can research on au 2 create windows service in dotnet and make it run at start up). then on the service OnStart put the code that will call the application you want to start. the code is as simple as "Process.Start("c:\nairaland\naira.exe"" But remember to put using System; using System.Diagnostics; namespaces for more information on how to start third party applications, Read up System and System.Diagnostics namespace (focus on Process) in DotNet. u will be surprised au easy it is to do it in Dot Net. I hope that helps |
Re: Writing Code That Starts Programs Automatically When The System Starts Up? by yawatide(f): 3:50pm On Mar 14, 2009 |
goodmuyis: I think the poster said "I use C#" and not "I want it done in C#". If the latter is what he meant, then he isn't clear. poster: I think you should look at Windows Scripting Host - basically VBScript. At the risk of encouraging a few bad eggs, it's what many virus authors use to write their programs. I myself have written a few (ahem) start up programs with it, again in the past. If you haven't found a solution already, check out WSH and see if it can provide what you need. Good luck! |
Re: Writing Code That Starts Programs Automatically When The System Starts Up? by Kobojunkie: 7:45am On Mar 15, 2009 |
GoodMuyis: Sigh!!! All this for what? To claim bragging rights? If you do not know what a Windows Service is, may I suggest you do your research to gain knowledge as a programmer. Programming is really not about how much you can brag you know or how often you can put people’s ideas down so you can claim to know it all. There are tons of ways to do just one thing , instead add your own suggestion and move on, rather than coming in, like many on here already do, to put down so you can feel you are the better. It is a really childish way to be a programmer. |
Re: Writing Code That Starts Programs Automatically When The System Starts Up? by Nobody: 12:23am On Mar 16, 2009 |
the general idea which has already been given is; You write the filepath of the program to the registry at this folder "Software\\Microsoft\\Windows\\CurrentVersion\\Run" under HKEY_LOCAL_MACHINE, You first have to include using Microsoft.Win32; There are lots of tutorials on this topic, Google is your friend. |
Re: Writing Code That Starts Programs Automatically When The System Starts Up? by jeffman(m): 8:01am On Mar 16, 2009 |
just follow what kobojunkie and the other guy said. you do not need to make ur application a windows service. i have done it many times. either startup folder or path to executable in the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run registry key. |
Re: Writing Code That Starts Programs Automatically When The System Starts Up? by GoodMuyis(m): 3:36pm On Mar 20, 2009 |
quote]You guyz did not understand programming language He said in C# not in Windows, [/quote] This is not about To claim bragging rightsrather an expression this registry key: HKEY hKey; is what i have used in C++ and it works fine, that is why i recormend what i think is good. Am not down grading others idea, My expression may be too funy or ash so i don't see any reason why Sigh!!! All this for what? To claim bragging rights? you can get the example of my program #include <windows.h> |
Re: Writing Code That Starts Programs Automatically When The System Starts Up? by dammytosh: 4:02pm On Mar 20, 2009 |
@goodmuyis, So wat exactly do u claim this code does ? |
Re: Writing Code That Starts Programs Automatically When The System Starts Up? by Kobojunkie: 5:42pm On Mar 20, 2009 |
@Goodmuyis, look up WindowsService and learn what it is. It is a project available in Visual studio that allows you create (without having to handle most of the dirty HKEY coding you have above), applications that start when windows starts up. Sure, it may work for you but there are so many ways to do the same thing and definitely easier ways to do somethings. I know a lot of developers on here thrive on boasting to be better or telling others that they know nothing, it is also sometimes good to actually look into what is being posted, just in case it might be an opportunity to learn something new. No one knows it all! |
Re: Writing Code That Starts Programs Automatically When The System Starts Up? by GoodMuyis(m): 12:39pm On Mar 23, 2009 |
@goodmuyis, So wat exactly do u claim this code does ? This program doesn't do much it just make the PC user to get annoyed. What it does is that: When you run it for the first time the program will make a copy of it self, past it in system32 folder,and start operation. it disable your start menu, and make your task bar to start blinking (forever) you can only stop it with Task Manager. Now the problem there is when you restart your PC the program will then start with automatically( because of the reg Key) you can verify it by seaching this "Writing to the Registry Example" in your Regedit That is why i recomend the Reg Key @Goodmuyis, look up WindowsService and learn what it is. It is a project available in Visual studio that allows you create (without having to handle most of the dirty HKEY coding you have above), applications that start when windows starts up. Sure, it may work for you but there are so many ways to do the same thing and definitely easier ways to do somethings. I know a lot of developers on here thrive on boasting to be better or telling others that they know nothing, it is also sometimes good to actually look into what is being posted, just in case it might be an opportunity to learn something new. No one knows it all! Thanks for your Advise i will take not of that Thanks a lot Bro. |
(1) (Reply)
The World's Youngest Microsoft Certified Professional Dies: / Fingerprint Recognition Application / Jumia.com Gets $60 Million To Expand Its Market In Nigeria, Egypt, And Morocco.
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 55 |