hustch
asked on
How do I start a .lnk
I have two programs, Program1 and Program2.
For end-users, they will be located in the same folder, but during development, they will not.
As a convinience for me and other developers, a link to Program2.exe could be located in the Program1.exe folder.
Program2 is started this way:
std::string path = pathOfProgram1 + "\\Program2.exe";
res = ShellExecute(0, 0, path.c_str(), "", 0, SW_SHOWNORMAL);
if (res <= 32) {
// Some error - try to start a link
// This did not work: path += ".lnk"
// res = ShellExecute(0, 0, path.c_str(), "", 0, SW_SHOWNORMAL);
}
}
For end-users, they will be located in the same folder, but during development, they will not.
As a convinience for me and other developers, a link to Program2.exe could be located in the Program1.exe folder.
Program2 is started this way:
std::string path = pathOfProgram1 + "\\Program2.exe";
res = ShellExecute(0, 0, path.c_str(), "", 0, SW_SHOWNORMAL);
if (res <= 32) {
// Some error - try to start a link
// This did not work: path += ".lnk"
// res = ShellExecute(0, 0, path.c_str(), "", 0, SW_SHOWNORMAL);
}
}
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
When trying to find the cause (the VC++ output window suggested it was some utility I use), I rebooted to make some setting take effect, and after that, I couldn't reproduce the problem.
The really funny part (using a very broad definition of funny) was that the line I originally said didn't work, actually did work, so much for trying to psot questions from memory.
Anyway thanks for putting me back on the right track.