Maybe, but it is obviously not universal method. Try to launch terminal from where your DE places it by default (menu, what's else). What do you see?
You get what you ask for

So if you start your terminal and wait for the prompt what else do you think is going to be invoked by the DE terminal program ? Exactly: your default shell.
But that was not OP question. OP's literal words are: "....from where the program was started?"
So if you start your program with the gnome terminal then the gnome terminal is the parent. If you wait for gnome to display the prompt from your default terminal and then invoke your FPC program then it will be your default shell. That is a matter of walking up the process tree.
@MarkMLI:
The idea is that when you know which DE terminal was used that you are able to delve into its configuration settings. But in case the distinction is enough then that will probably do as well (which was indeed my first line of thought) I can't decide for OP what is sufficient for OP's situation (not a lot of context there).