View Full Version : how to invoke beyond compare through mfc c++
Is there a way to use Beyond compare through mfc application?
thnx
kings
Ernie
21-Apr-2006, 01:04 PM
If you are talking about launching BC2, there's always the Win32 CreateProcess() call.
If not, explain what you are trying to do.
Chris
21-Apr-2006, 04:11 PM
Beyond Compare doesn't have an API.
It is possible to write a Beyond Compare script and call it from another application.
You can pass command line arguments into the script by using the %1, %2, etc variables in the script.
For details see the Command Line & Scripting section of Beyond Compare's help file. Our Script Central discussion forum is also a good resource.
kingslee
25-Apr-2006, 07:50 AM
thnks Ernie and Chris for your information.
I just want to use beyond compare with my application.
I try with create process or calling a system command.
If i still find a problem , I get back to you guys .
thanks
kings
kingslee
10-May-2006, 11:54 AM
I used system -its always opening the command prompt with BC. I thaught of using CreateProcess(). can you give me a simple example of it .
because in system i simply call
system("\"C:\\Program Files\\Beyond Compare 2\\BC2.exe\" c:\\src.txt c:\\dest.txt");
waiting for your reply.
mfg
kingsly
kingslee
10-May-2006, 12:17 PM
Sorry! to make it more precise - how to pass the two arguments in the create process.
if(!CreateProcess("C:\\Program Files\\Beyond Compare 2\\BC2.exe", // Application name
TEXT("c:\\src.txt c:\\dest.txt"), // Application arguments
0,
0,
FALSE,
CREATE_DEFAULT_ERROR_MODE,
0,
0, //
Working directory
&siStartupInfo,
&piProcessInfo) )
It opens only the C:\\dest.txt file. I dont know how to give the application argument.
thnx in advance.
kings
Ernie
10-May-2006, 05:26 PM
You have to pass the program name, as well as the arguments:
if(!CreateProcess("C:\\Program Files\\Beyond Compare 2\\BC2.exe", // Application name
TEXT("\"C:\\Program Files\\Beyond Compare 2\\BC2.exe\" c:\\src.txt c:\\dest.txt"), // Application arguments
0,
0,
FALSE,
CREATE_DEFAULT_ERROR_MODE,
0,
0, //
Working directory
&siStartupInfo,
&piProcessInfo) )
kingslee
11-May-2006, 03:24 AM
Thanks Ernie..
It works .
:)
vBulletin® v3.7.1, Copyright ©2000-2010, Jelsoft Enterprises Ltd.