User forums > Using Code::Blocks

Open file for editing from another program

(1/1)

mikex:
I am trying to open a .cpp file to edit by executing a 'codeblocks theFile.cpp' command from another program, but I get the following message:

Another program instance is already running.

I only want one copy of codeblocks running, I just want 'theFile.cpp' to come up in the editor under a new tab.  Is there some undocumented command line switch that will send a signal to codeblocks dde server to just open the file?

I'm running under windows XP SP2 and I've tried associating .cpp with codeblocks and issuing a 'cmd.exe theFile.cpp' but that just blocks execution in my calling program even though I've issued the command asynchronously.

mariocup:
Hi,

If you want to open a new file in CodeBlocks you could use the shell extension plugin, that integrates a file explorer in CodeBlocks.

See the manual http://www.codeblocks.org/user-manual section "File Explorer and Shell Extension Plugin"  for details.

Bye,

Mario

dmoore:

--- Quote from: mikex on March 18, 2008, 09:06:44 pm ---I am trying to open a .cpp file to edit by executing a 'codeblocks theFile.cpp' command

--- End quote ---

if CB is associated with .cpp files, it should be enough to use "theFile.cpp" as the command line (it at least works at the dos prompt, but if it doesn't work in your program you might try "cmd /c theFile.cpp" instead). it shoud be asynchronous.

mikex:
Worked like a charm dmoore, that /c did the trick.

Many thanks :D

Navigation

[0] Message Index

Go to full version