One of the problems I often run into, is that I will include ‘Windows‘ in my uses clause, and then I will later add ‘JwaWinBase‘ for some specific calls.
However, many of the functions in the ‘Windows’ unit are the same as in JwaWinBase, and I start getting errors in my main unit, all over the place, until I fix all my calls by pre-pending the correct unit name, like this:
Old:
- CreateProcessAsUser(…)
New:
- Windows.CreateProcessAsUser(…)
- JwaWinBase.CreateProcessAsUser(…)
What I want to know, is if there is a way to have the unit name automatically pre-pended to every call to a function in another unit? This way, before I added JwaWinBase to my uses clause, I could have the ‘Windows’ unit name pre-pended to any function calls. Then adding JwaWinBase wouldn’t give me any errors.
I’m currently using Delphi 2007.
There isn’t.
However, the function calls are handled in the reverse order they’re in the uses clause, so that if you have this:
… it will call Jwa functions by default. However, if you reverse them:
… it should call the Windows functions by default, and you can preface your Jwa functions as required.