Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: Ken_SF on May 18, 2021, 12:38:51 am
-
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?
-
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...
-
Why do you need to know that?