We're currently using test complete in one our dev environments. I've been given the task of setting it up to run against all 3 of our testing environments and I'm stuck. We're using Visual Studio to...
We have a similar situation. I handle it in my framework. When I generate a new test run to execute, part of that generation includes referencing what we call a "run definition". That includes several parameters and such to indicate a) what application is being tested, b) which test cases are included, c) what environment it executes in.
Then, when the test run kicks off, it reads the environment part of the rundefinition into a ProjectSuite variable which we then reference anywhere in our test cases where we need to navigate to a new page manually (as opposed to clicking links).
That's one solution... but something similar could work for you where you could have your build set a system environment variable and have your tests configured to read that value and utilize it anywhere a URL is referenced.
In our case, the framework is created/generated separate from our build process. So, if you want to have it created from your build, then yes, something in the build process of your application under test will need to generate the environment value to use.
As with many such things, there are many ways of achieving the same result. How you set the environment is something that you'll have to do within your organizational process. The key where it intersects with TestComplete is writing code in your automation that will read the environment value from whereever you have set it and utilize it within your tests. We have code in TestComplete that reads the value from an SQL table and populates the project suite variable. Your code may be different, depending upon how you choose to generate the value.