News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

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

Started by Ken_SF, May 18, 2021, 12:38:51 AM

Previous topic - Next topic

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

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]