What unit of volume do I need for this?

I try to install a third-party package, and I get a compilation error:

[DCC Error] fiile/line : E2003 Undeclared identifier: 'Windows' 

which refers to this line:

 wnd := Windows.GetFocus; 

It seems pretty obvious that I don’t have the right to my units of measure - but do I need it (and is there a general approach to determine which condition of use I need)?

I currently have

 Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;System;Xml;Data;Datasnap;Web; Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;Winapi;System.Win 

[Refresh]

 interface uses SysUtils, winapi.windows, Classes, Controls, ExtCtrls, Graphics, StdCtrls, Dialogs, IniFiles, winapi.messages, Forms, Math {$IFDEF DELPHI6_LVL} , Variants {$ENDIF} ; 

There is no use in impementation section.

[Upate] I forgot to mention. I was unable (exactly the same) to install it on one laptop. Then I succeeded for a second. The trouble is that I would prefer it on my desktop, and after a new installation of the XE2 starter, I will get these problems.

+4
source share
2 answers

Assuming your names will be used as a single Windows unit, he seems to do this by naming the device as Winapi.Windows. And so your code should also do this and write as

 wnd := Winapi.Windows.GetFocus; 

When you use a device by giving the name of the unit with full coverage, you should also use the name with full coverage in the following code on this device.

Now, if you want to use the Windows name, you must name the device as Windows in the uses clause and allow the block alias setting to do its job. If you imported the device, calling it Windows, your source code will work.

To be extremely clear:

 uses Winapi.Windows; 

- this is what you have now, but you need:

 uses Windows; 

to compile your code.

+2
source

Scope looks ok, so try these two options

declare in your section using Windows instead of Winapi.Windows

or change your code like this

 wnd := Winapi.Windows.GetFocus; 
+3
source

Source: https://habr.com/ru/post/1396129/


All Articles