Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6657713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:48:15+00:00 2026-05-26T01:48:15+00:00

I am developing an application in C++ that has an option autostart. When user

  • 0

I am developing an application in C++ that has an option “autostart”. When user set that option, program should change something in Windows to be started by Windows on next Windows boot and user logon. Also when user unset this option, the program must put things back.

I don’t need to run app as a service, so it would enough to run under certain user’s account after user logon. So what is the best way to make windows run my app. on next boot and user logon? I googled up an advice to use a startup folder. Is that most nice and harmless way?

If so, i have 2 questions:

  1. How to detect startup folder. I am not happy with SHGetSpecialFolderLocation()‘s output. It seems it returns my “HOME” directory in testing WinXP platform (C:\Documents and settings\%username%).
  2. How to create .lnk file using C++ there? I think copying entire .exe file would be bad idea.

Actually my program is cross-platform, but an option “autostart” will be windows-only.

Update

  1. Tried SHGetSpecialFolderLocation and got a good value in Windows7: “C:\Users\Pavel\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup”
    NOTICE: If you use MinGW, you should define _WIN32_IE to 0x0400, before including ShlObj.h.

  2. What is the best solution (in point of view good programming) between using registry (HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run) and the startup folder?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:48:16+00:00Added an answer on May 26, 2026 at 1:48 am

    I’d suggest using registry keys like HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run. Create a string value here with the name of your software and value of your main executable path – this should suffice. Much easier then creating a .lnk file – and registry editing API is easily accessible from C++

    UPDATE:

    As @Ben suggested, for your task it’s better to use HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run. This will autostart your app for current user only, while my first suggestion will do this for all users.

    UPDATE2:

    Also note that whatever method you choose for implementing autostart, you might get problems with antivirus software as most of antiviruses with proactive defense are watching closely for making programs auto-running.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an application in MinGW/C++ that uses Windows' common dialogs. The need has
I am actually developing and application that has around 15 modules, all of them
Ok, I'm developing an application that has been in pretty much continous development over
I'm developing a web application that has to support lots of simultaneous requests, and
I am developing an application that currently has a View Controller (call it ViewControllerX).
I am developing a multilingual web application that has a nice looking UI. I
I'm developing an application on a hardware device that has a built-in hardware keyboard
I'm developing a small utility application that needs to detect whether another one has
I am developing a Java webservice application (with JAX-WS) that has to use two
I'm developing a Java application using Eclipse. My project has two source directories that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.