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?
-
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.Dsm– Dsm2017-11-14 10:01:42 +00:00Commented 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 projectFederico Pessina– Federico Pessina2017-11-14 10:03:35 +00:00Commented Nov 14, 2017 at 10:03
-
Works opening file directly, probably it was not working due to an implicit cast gone wrongFederico Pessina– Federico Pessina2017-11-14 10:17:15 +00:00Commented Nov 14, 2017 at 10:17
Add a comment
|
1 Answer
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)
5 Comments
Federico Pessina
Nice! This will open it in a new IDE. I was missing the double quotes around the filename
David Heffernan
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.Uli Gerhardt
AFAIK double-clicking in explorer uses bdslauncher.exe, not bds.exe. Maybe this causes the "new IDE" issue.
Rudy Velthuis
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);user1580348
But how to open the project in the RUNNING IDE without creating another BDS.exe instance?