0

I would open .dproj files programmatically with embarcadero studio. I know the path to dproj file and path to bds.exe, how can i do it?

3
  • If you double-click a project file it opens in Delphi. That means that you should just be able to "shell execute" the file. Alternatively call bds with the filename as the first parameter. Commented Nov 14, 2017 at 10:01
  • yet tried both solutions and doesn't work: opening the file does nothing, calling bds with filename as parameter open the IDE but does not open the project Commented Nov 14, 2017 at 10:03
  • Works opening file directly, probably it was not working due to an implicit cast gone wrong Commented Nov 14, 2017 at 10:17

1 Answer 1

2

You can open a delphi project from a cmd with the command: "C:\DelphiInstallation\bin\bds.exe" -pDelphi "C:\Source\YourProjectFile.dproj"

From within Delphi you can use this code:

 ShellExecute(Application.Handle,
  'open',
  PChar('"C:\DelphiInstallation\bin\bds.exe"'),
  PChar('-pDelphi "C:\Source\YourProjectFile.dproj"'),
  nil,
  SW_SHOWNORMAL)
Sign up to request clarification or add additional context in comments.

5 Comments

Nice! This will open it in a new IDE. I was missing the double quotes around the filename
1. CreateProcess is the right API to use to create a new process. 2. If you must involve the shell (no need to here), but if you must then use ShellExecuteEx because it has sane error reporting.
AFAIK double-clicking in explorer uses bdslauncher.exe, not bds.exe. Maybe this causes the "new IDE" issue.
FWIW, if the strings are literals, you can omit the PChar() casts: ShellExecute(Application.Handle, 'open', '"C:\etc.."', '-pDelphi "C:\Source\etc..."', nil, SW_SHOWNORMAL);
But how to open the project in the RUNNING IDE without creating another BDS.exe instance?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.