Need help to allow a working Delphi 3 project to build on Delphi XE

How do I adjust this working Delphi 3 program that uses OLEAUTO and OLE2 to work on the newer Delphi XE,

Program code is below this, errors are here :

Checking project dependencies...

Compiling admn_api.dproj (Debug, Win32)

dcc command line for "admn_api.dpr"

  c:\program files (x86)\embarcadero\rad studio\8.0\bin\dcc32.exe -$O- -$W+ --no-config -M -Q -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;
  DbiProcs=BDE;DbiErrs=BDE -DDEBUG -I"c:\program files (x86)\embarcadero\rad studio\8.0\lib\Win32\release";"C:\Users\Administrator\Documents\RAD 
  Studio\8.0\Imports";"c:\program files (x86)\embarcadero\rad studio\8.0\Imports";"C:\Users\Public\Documents\RAD Studio\8.0\Dcp";"c:\program files 
  (x86)\embarcadero\rad studio\8.0\include" -LE"C:\Users\Public\Documents\RAD Studio\8.0\Bpl" -LN"C:\Users\Public\Documents\RAD Studio\8.0\Dcp" 
  -O"c:\program files (x86)\embarcadero\rad studio\8.0\lib\Win32\release";"C:\Users\Administrator\Documents\RAD Studio\8.0\Imports";"c:\program files 
  (x86)\embarcadero\rad studio\8.0\Imports";"C:\Users\Public\Documents\RAD Studio\8.0\Dcp";"c:\program files (x86)\embarcadero\rad studio\8.0\include" 
  -R"c:\program files (x86)\embarcadero\rad studio\8.0\lib\Win32\release";"C:\Users\Administrator\Documents\RAD Studio\8.0\Imports";"c:\program files 
  (x86)\embarcadero\rad studio\8.0\Imports";"C:\Users\Public\Documents\RAD Studio\8.0\Dcp";"c:\program files (x86)\embarcadero\rad studio\8.0\include" 
  -U"c:\program files (x86)\embarcadero\rad studio\8.0\lib\Win32\release";"C:\Users\Administrator\Documents\RAD Studio\8.0\Imports";"c:\program files 
  (x86)\embarcadero\rad studio\8.0\Imports";"C:\Users\Public\Documents\RAD Studio\8.0\Dcp";"c:\program files (x86)\embarcadero\rad studio\8.0\include" 
  -K00400000 -NB"C:\Users\Public\Documents\RAD Studio\8.0\Dcp" -NH"C:\Users\Public\Documents\RAD Studio\8.0\hpp"   admn_api.dpr   

[DCC Warning] App_obj.pas(25): W1006 Unit 'OleAuto' is deprecated

[DCC Error] App_obj.pas(189): E2003 Undeclared identifier: 'VarIsNULL'

[DCC Error] App_obj.pas(189): E2003 Undeclared identifier: 'varisempty'

[DCC Error] App_obj.pas(189): E2012 Type of expression must be BOOLEAN

[DCC Fatal Error] admn_api.dpr(5): F2063 Could not compile used unit 'App_obj.pas'

Failed

Elapsed time: 00:00:01.7

****** Program code **********  :

{/***************************************************************************
$name: UNIT1.PAS 
$version: 1.0 
$date_modified: 121198 
$description: Pascal source file
$owner: GroupWise SDK Team Lead
Copyright (c) 1998 Novell, Inc. All Rights Reserved.

THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND TREATIES.
USE AND REDISTRIBUTION OF THIS WORK IS SUBJECT TO THE LICENSE AGREEMENT
ACCOMPANYING THE SOFTWARE DEVELOPMENT KIT (SDK) THAT CONTAINS THIS WORK.
PURSUANT TO THE SDK LICENSE AGREEMENT, NOVELL HEREBY GRANTS TO DEVELOPER A
ROYALTY-FREE, NON-EXCLUSIVE LICENSE TO INCLUDE NOVELL'S SAMPLE CODE IN ITS
PRODUCT. NOVELL GRANTS DEVELOPER WORLDWIDE DISTRIBUTION RIGHTS TO MARKET,
DISTRIBUTE, OR SELL NOVELL'S SAMPLE CODE AS A COMPONENT OF DEVELOPER'S
PRODUCTS. NOVELL SHALL HAVE NO OBLIGATIONS TO DEVELOPER OR DEVELOPER'S
CUSTOMERS WITH RESPECT TO THIS CODE.
****************************************************************************/}
unit App_obj;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, OleAuto, Ole2, ComObj, ActiveX, ComServ;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label6: TLabel;
    UserID: TEdit;
    Label7: TLabel;
    LastName: TEdit;
    Label8: TLabel;
    FirstName: TEdit;
    UserDistinguishedName: TEdit;
    Label10: TLabel;
    SystemInfo: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    SystemDescription: TEdit;
    SystemDistinguishedName: TEdit;
    SystemLastModifiedBy: TEdit;
    ConnectedDomainName: TEdit;
    SystemObjectID: TEdit;
    PostOfficeList: TComboBox;
    Label11: TLabel;
    Label9: TLabel;
    UserContext: TEdit;
    Label12: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    Label16: TLabel;
    DomainPath: TEdit;
    Button2: TButton;
    procedure Initialize(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  vSystem:variant;
  vDomain:variant;

const
  ADMIN_NAME = 'Admin';
  sDOT = '.';

implementation

{$R *.DFM}

procedure TForm1.Initialize(Sender: TObject);
begin
     //Initialize controls
     DomainPath.Text:='';
     SystemDescription.Text:='';
     SystemDistinguishedName.Text:='';
     SystemLastModifiedBy.Text:='';
     ConnectedDomainName.Text:='';
     SystemObjectID.Text:='';

     UserID.Text:='';
     LastName.Text:='';
     FirstName.Text:='';
     UserDistinguishedName.Text:='';
     UserContext.Text:='';
     UserID.SetFocus;

end;

procedure TForm1.Button1Click(Sender: TObject);
var
   vUsers:variant;
   vUser:variant;
   stemp:string;
   idotpos:integer;
   SelectedPO:string;
   sAdmin:string;
begin
   //Get Selected PostOffice
   SelectedPO:=PostOfficeList.Items[PostOfficeList.ItemIndex];

   //Get Users Object
   vUsers:=vDomain.Users;

   //Find Admin user object
   vUser:=vUsers.Item(ADMIN_NAME,SelectedPO,ConnectedDomainName.Text);

   If UserContext.Text = '' then begin

     //Get Admin Context and use as Default
     sAdmin:=vUser.NetID;
     idotpos:=Pos(sDOT,sAdmin);
     stemp:=Copy(sAdmin,idotpos,256); //Copy everything after first dot include dot
     UserContext.Text:=stemp;

   end else begin
     //Use context string
     stemp:=UserContext.Text;
   end;

   //Make Distinguished name by adding UserID and admin context
   stemp:=UserID.Text+stemp;

   //Display User distinguished name
   UserDistinguishedName.Text:=stemp;

   //Add user
   vUser:=vUsers.Add(UserID.Text,LastName.Text,stemp,
          '',SelectedPO);

   //Set User first name
   vUser.GivenName:=FirstName.Text;

   //Commit User first name to system
   vUser.Commit;
end;



procedure TForm1.Button2Click(Sender: TObject);
var
 vPostOffice:variant;
 vPostOffices:variant;
 vPOIterator:variant;

begin
     //Get GroupWise Admin Object and connect to it
     if(DomainPath.Text = '') then begin
        ShowMessage('You must enter a valid Domain Path.  Then press Login');
        exit;
     end;
     vSystem:=CreateOleObject('NovellGroupWareAdmin');

     vSystem.Connect(DomainPath.Text);
     //Get the connected Domain
     vDomain:=vSystem.ConnectedDomain;

     //List some Domain properties
     SystemDescription.Text:=vDomain.Description;
     SystemDistinguishedName.Text:=vDomain.DistinguishedName;
     SystemLastModifiedBy.Text:=vDomain.LastModifiedBy;
     ConnectedDomainName.Text:=vDomain.Name;
     SystemObjectID.Text:=vDomain.ObjectID;

     //Initialize controls
     UserID.Text:='';
     LastName.Text:='';
     FirstName.Text:='';
     UserDistinguishedName.Text:='';
     UserContext.Text:='';
     UserID.SetFocus;

     //Get list of PostOffices for connected Domain
     vPostOffices:=vDomain.PostOffices;
     vPOIterator:=vPostOffices.CreateIterator;
     vPostOffice:=vPOIterator.Next;
     PostOfficeList.Clear;
     While( (NOT VarIsNULL(vPostOffice)) And (NOT varisempty(vPostOffice))) do begin
        PostOfficeList.Items.Add(vPostOffice.Name);
        vPostOffice:=vPOIterator.Next;
     end;

     //Set index to first item in list
     PostOfficeList.ItemIndex:=0;
end;

end.
0
Bob
9/24/2013 10:19:15 PM
embarcadero.delphi.ole 598 articles. 1 followers. Follow

2 Replies
2068 Views

Similar Articles

[PageSpeed] 47

Bob wrote:

> [DCC Warning] App_obj.pas(25): W1006 Unit 'OleAuto' is deprecated

Replace the OleAuto unit with the System.Win.ComObj unit in your uses clause.

> [DCC Error] App_obj.pas(189): E2003 Undeclared identifier: 'VarIsNULL'
> 
> [DCC Error] App_obj.pas(189): E2003 Undeclared identifier:
> 'varisempty'

Add the System.Variants unit to your uses clause.

> [DCC Error] App_obj.pas(189): E2012 Type of expression must be BOOLEAN

That is just a side effect of the undefined identifier errors.

--
Remy Lebeau (TeamB)
0
Remy
9/24/2013 11:36:42 PM
Remy,

Thank You so much ! .  I added comobj, variants and no errors.

Have a great day.
Bob Perez

*******************************************************************

> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> Bob wrote:
> 
> > [DCC Warning] App_obj.pas(25): W1006 Unit 'OleAuto' is deprecated
> 
> Replace the OleAuto unit with the System.Win.ComObj unit in your uses clause.
> 
> > [DCC Error] App_obj.pas(189): E2003 Undeclared identifier: 'VarIsNULL'
> > 
> > [DCC Error] App_obj.pas(189): E2003 Undeclared identifier:
> > 'varisempty'
> 
> Add the System.Variants unit to your uses clause.
> 
> > [DCC Error] App_obj.pas(189): E2012 Type of expression must be BOOLEAN
> 
> That is just a side effect of the undefined identifier errors.
> 
> --
> Remy Lebeau (TeamB)
0
Bob
9/25/2013 2:11:33 AM
Reply: