User forums > Using Code::Blocks

Is there a simple way to determine if compiled program is run from IDE

(1/1)

Ken_SF:
Hi,

I am using Code::Blocks 17.12 with C++ for Win32 programming.

Is there an easy way to determine if a compiled program was launched from the IDE or manually by clicking on the compiled program in its directory?

The best I have been able to come up with is to use Window's  GetCurrentDirectory function and see if the program was launched from my project directory or the Debug/Release directories that are created for me by Code::Blocks when I build a project from within the IDE.

Suggestions?

BlueHazzard:
I would use arguments...

If you start the program in codeblocks, you add the argument -CB or similar in Project->Set programs argument and then in your program you check if the argument is present....
If you run it from the explorer you do not have the argument...

oBFusCATed:
Why do you need to know that?

Navigation

[0] Message Index

Go to full version