0

(1) I want to make my program run at startup. I did that step:
I added my program path to that registry key:

  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run [Or]
  • HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run

enter image description here

Previously, the program was running at startup but after I have added the Manifest File to give my program the administrative privileges as follow:

Since that action, the program doesn't run at startup.

Finally, the code which adds the value to Software\\Microsoft\\Windows\\CurrentVersion\\Run:

// Set launch at startup setting
bool startup = wxAtoi(CPublic::getConfigItem("settings/startup"));
wxString appName = wxTheApp->GetAppName();
wxRegKey regKey(wxRegKey::HKCU, "Software\\Microsoft\\Windows\\CurrentVersion\\Run");
if (startup == 1) {
    regKey.SetValue(appName, wxStandardPaths::Get().GetExecutablePath());
} else {
    regKey.DeleteValue(appName);
}

What's the problem then?


(2) There is another simple question related to that question:
How to make my program hides after running at startup into the system tray?

Lion King
  • 32,851
  • 25
  • 81
  • 143
  • To answer your second question, use ``Shell_NotifyIcon``: https://msdn.microsoft.com/en-us/library/windows/desktop/bb762159(v=vs.85).aspx – Asesh May 20 '18 at 11:51

1 Answers1

0

To answer the 2nd question (the 1st one is answered in the comment by @Snetfel above), you simply need to create a wxTaskBarIcon and avoid creating any (visible) normal windows on startup.

VZ.
  • 21,740
  • 3
  • 39
  • 42
  • Thanks, regarding the 2nd question I mean how to make my program just at startup to hide its window into the system tray (execute a specific method its job hides the program window into the system tray just at startup) – Lion King May 20 '18 at 15:33
  • Regarding the 1st question, I have read the question that `Sneftel` pointed out but unfortunately, I still understand because they talking about something not clear to me. so, if it possible to explain me the direct way to do so? – Lion King May 20 '18 at 15:43
  • @LionKing, take a look at the taskbar sample. It should give you an idea how to make it work. – Igor May 21 '18 at 19:32