User forums > Using Code::Blocks

Bring C::B to front when opening file via command line

(1/3) > >>

daniloz:
Hi All,

Is it possible to "force" C::B to "pop up" (i.e. bring to front of other windows) when opening a file via command line?

I have the following command line

--- Code: ---c:\Path_to_CB\codeblocks.exe file.cpp

--- End code ---

When I run it from the command line (or from another application - that's what I want ultimately), "file.cpp" is opened inside C::B, but the window doesn't pop up in front of others, so I have to manually click on it on the taskbar.

However, if I use the DDEserver, by just double-clicking in a file on Windows Explorer (Total Commander, actually ;-) ), then the C::B window DOES pop-up...

I haven't found any command line option to make what I want happen...

Thanks!
Btw, I'm running C::B rev. 7096 compiled from trunk with wx 2.8.10 on Windows 7.

Jenna:
It works here on XP (will test on win7 with latest trunk later).

Are both checkboxes in "Settings -> Environment... -> General settings -> Dynamic Data Exchange" active ?

daniloz:

--- Quote from: jens on April 14, 2011, 10:08:21 am ---It works here on XP (will test on win7 with latest trunk later).

Are both checkboxes in "Settings -> Environment... -> General settings -> Dynamic Data Exchange" active ?

--- End quote ---

Yeah, both ticked... But, I'm not using DDE when I call it from the command line, am I?

EDIT:
It works if C::B is in back, but maximized... However, if C::B is minimized, then it only get maximized when double-clicking in a file in Explorer, not when using the command-line...

Jenna:

--- Quote from: daniloz on April 14, 2011, 10:36:22 am ---Yeah, both ticked... But, I'm not using DDE when I call it from the command line, am I?

EDIT:
It works if C::B is in back, but maximized... However, if C::B is minimized, then it only get maximized when double-clicking in a file in Explorer, not when using the command-line...

--- End quote ---

The newly started C::B uses DDE (on windows) or a socket (on linux) to communicate with the running instance of C::B.
Thanks for the second hint, that should be easy to fix (hopefully).

daniloz:

--- Quote from: jens on April 14, 2011, 11:31:06 am ---Thanks for the second hint, that should be easy to fix (hopefully).

--- End quote ---

Attached is a patch to fix it...

Also, related to some cross-posting, here are my answers to the following discussion:


--- Quote from: oBFusCATed on May 24, 2012, 08:01:38 pm ---No, I doubt that forcing the maximizing is the right thing to do, but you should provide a patch there, where the context is correct.

--- End quote ---


--- Quote from: MortenMacFly on May 24, 2012, 08:24:22 pm ---Btw: Instead of IsMaximized() you should check for !IsIconised() and issue a Show() then... IMHO that's the better option. Notice the Iconised, not Iconized... ;-)

--- End quote ---

Thanks MortenMacFly for the suggestion, I also think that IsIconized() is the right check here. However, instead of Show(), I'am issuing a Iconize(false), since the documentation says that Show() is the opposite of Hide(), whereas here I've found that Iconize(false) is what I want.

Just a strange thing. In my local copy (rev. 7993, wx2.8.12, win7 64-bit) and in the documentation, the functions are IsIconiZed() and IconiZe(false), both with Z. Do you have another version of wxWidgets??  :o

Navigation

[0] Message Index

[#] Next page

Go to full version