I'm having an issue getting a program to run on startup on Windows 8 32-bit and 8.1 32-bit, but it works fine on 8 and 8.1 64-bit and other OS.
I'm installing the latest version of our software and setting a new HKLM\Software\Microsoft\Windows\CurrentVersion\Run registry key that contains the path of the executable ("C:\Program Files......exe").
The program does not run or show up in the task manager as trying to run/start. Other programs in the run folder are starting up and running, plus I tested by adding notepad.exe and it opened fine.
If I run the path from a command window it opens and starts fine. I can create a batch file and the batch file will run on startup, but it still won't run the EXE from that batch file. If I create a EXE wrapper that starts a process with that path it will run the EXE and then also will start the EXE in the path.
Anyone have any ideas on why it won't run the EXE from the path?
function MethodName(hMSI)
NUMBER nOptions, nType, nSize;
STRING strPath;
begin
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
nOptions = REGDB_OPTIONS;
nType = REGDB_STRING;
REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
if (RegDBGetKeyValueEx("SOFTWARE\\Temp", "PathLocation", nType, strPath, nSize) < 0) then
RegDBGetKeyValueEx("SOFTWARE\\Wow6432Node\\Temp", "PathLocation", nType, strPath, nSize);
endif;
if (SYSINFO.bIsWow64) then
RegDBSetKeyValueEx("SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Run", "RunKey", nType, strPath, nSize);
else
RegDBSetKeyValueEx("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", "RunKey", nType, strPath, nSize);
endif;
REGDB_OPTIONS = nOptions;
end;
A somewhat hacky way to accomplish this is to add a shortcut to your executable to %appdata%\Microsoft\Windows\Start Menu\Programs\Startup\
.
For InstallShield, it looks like you want the AddFolderIcon function:
AddFolderIcon(FOLDER_STARTUP, "The name of the shortcut", "C:\YourProgram.exe", "", "C:\PathTo\YourIcon.ico", 0, "", REPLACE);
Take a look here for a full example of how this can be used.