Solved

AutoStart dirs!

Posted on 2001-09-16
11
323 Views
Last Modified: 2010-04-06
How to find the 2 autostart dirs?

0
Comment
Question by:SULTAN
  • 3
  • 2
  • 2
  • +3
11 Comments
 
LVL 3

Expert Comment

by:rondi
ID: 6486705
What are the '2 autostart dirs' ?

If you're tryna run your program when Windows starts,
place the path to your EXE in the Registry key
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run

like this:

with TRegistry.Create do
  try
    RootKey := HKEY_LOCAL_MACHINE;
    OpenKey('Software\Microsoft\Windows\CurrentVersion\Run', True);
    WriteString('MyDelphiApp',Application.ExeName);
    CloseKey;
  finally
    Free;
  end;

you can make your app run exclusively (ie. Windows doesn't
finish loading till your app is done) by writing to the
RunOnce key instead.

rondi.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 6486708
2 autostart dirs? Nope, there are at least 11:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServices
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce
C:\Windows\Startmenu\Programs\Startup
C:\Windows\Win.ini\[Windows]\run
C:\Windows\Win.ini\[Windows]\load

Regards, Madshi.
0
 
LVL 8

Expert Comment

by:TOndrej
ID: 6486734
> at least 11

***at least***
:-) LOL Madshi, I liked that :-)

"That you're paranoid doesn't mean they're not after you"
:-)
Keep hackin'
0
 
LVL 20

Expert Comment

by:Madshi
ID: 6486745
:-)  Well, you can do ugly things like putting a little vxd into the system\iosubsys folder, than the vxd is loaded automatically at startup. Or you can install a dummy driver like a printer driver, or you can register a shell extension. All those dlls/drvs/vxds can start level 3 applications later. If you count such hacks, we have more than 11 ways to do autostarting...  (-:
0
 
LVL 14

Expert Comment

by:AvonWyss
ID: 6487209
Or you can use Windows NT/2K, where you've got two startup dirs in the start menu: one for the user logged in and one for all users.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 6

Expert Comment

by:edey
ID: 6488214
And, I think, Netware login scripts too?
For that matter if someone was silly enough to use an unsecured active desktop wall paper (and click through the warning message) you edit the wall paper & use the WSh to call anythin you wanted. It's a good thing you can't use an .hta for a wall paper or someone could set your wallpaper to an .hta that _looked_ like your wall apper & you'd never know it.

GL
Mike
0
 

Author Comment

by:SULTAN
ID: 6488864
C:\Windows\Startmenu\Programs\Startup

thats the one i wanted, but that can bee difrent on difrent computers
0
 
LVL 20

Accepted Solution

by:
Madshi earned 10 total points
ID: 6489507
You can use something like this (not tested):

function GetStartupFolder : string;
var pidl   : PItemIDList;
    arrCh  : array [0..MAX_PATH] of char;
    malloc : IMalloc;
begin
  if SHGetSpecialFolderLocation(GetDesktopWindow, CSIDL_STARTUP, pidl) = 0 then begin
    if SHGetPathFromIDList(pidl, arrCh) then
         result := arrCh
    else result := '';
    if SHGetMalloc(malloc) = 0 then
      malloc.Free(pidl);
  end else
    result := '';
end;

Regards, Madshi.
0
 
LVL 3

Expert Comment

by:rondi
ID: 6489547
Use the SHGetFolderLocation API, using CSIDL_STARTUP.

That'll get the folder, whatever the path is
0
 

Author Comment

by:SULTAN
ID: 6514126
Isent there like 2 start up groups?? Users & All Users?
0
 
LVL 14

Expert Comment

by:AvonWyss
ID: 6514426
Sutan, only on Windows NT/2K/XP. Windows 9X/ME do not have this feature.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
add combobox item based on numbers 9 123
FMX enumerated colours 2 84
LAN or WAN ? 11 82
Installshield for Embarcadero EX 10.1 Berlin 4 20
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

910 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now