Link to home
Start Free TrialLog in
Avatar of hustch
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);
  }
}

ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hustch
hustch

ASKER

Funny, jkr's suggestion was actually what didn't work, because it caused a AV in CmdLineExt03.dll.
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.