What happened to Application.handle in Delphi XE?

1.3k views Asked by At

I'm porting some code to Delphi XE and noticed that if I use Application.Handle to get the handle of the program, Delphi throws me an error and refuses to compile, saying:

Undeclared identifier: 'Handle'

This same behavior happens when I try to call Application.ProcessMessages. I figure something must have gotten shifted around that wasn't listed in the Unicode Migration guide.

Where did the functions and variables for 'Application' go?

1

There are 1 answers

14
David Heffernan On BEST ANSWER

My psychic debugging powers tell me that this unit imports SvcMgr after it imports Forms and so the Application variable in SvcMgr takes the one that you want in Forms out of scope. Or perhaps the culprit is WebBroker or CtlPanel.

You can work out which it is by CTRL clicking on the Application variable at the point of the first error and you'll land in a unit that isn't Forms.

The solution is just to reorder your imports so that Forms comes in after the others.

On the other hand, my psychic debugging powers could be broken today!