Ver Mensaje Individual
  #1  
Antiguo 24-03-2009
cmm07 cmm07 is offline
Miembro
 
Registrado: nov 2007
Posts: 526
Reputación: 17
cmm07 Va por buen camino
error en RemObjects Pascal Script

Hola, como estan foros, pues teng un error con estos componentes, miren tengo una Unidad hecha por mi:

esto es lo que tiene(es medio largo):

Código Delphi [-]
unit Max;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Gauges, Registry, ShlObj, ActiveX,IdHTTP, WinInet, ComObj, ShellApi, IniFiles;

Function ShowMessage1(Text: String; Tipo: TMsgDlgType): String;
Function Delay(msecs:integer): Integer;
Function CopyProg(Origen1, Destino1, NameFile: String; Gauges: TGauge; Labels: TLabel): String;
Function CopyLista(Archivo: String; NArchivoTot: Integer; Destino: String; Gauges: TGauge; Labels: TLabel; Forms: TForm): String;
function LineasVisibles(Memo: TMemo): integer;
Function LeeReg(RootKeys: HKEY; Key: String; NameValue: String): String;
Function CreaReg(RootKeys: HKEY; Key: String; NameValue: String; Value: String): String;
Function DelKey(RootKeys: HKEY; Key: String): String;
Function IfReg(RootKeys: HKEY; Key: String; ValueExists1: String): Boolean;
Function CreaDir(Directory: String): String;
Function DeleteDir(Directory: String): String;
Function SelectDir(Directory: String): String;
Function CreaLnk( Exe, Argumentos, DirTrabajo, NombreLnk, DirDestino:string): String;
Function EjecutaExe(Exe: String; Forms: TForm): String;
Function RunAndWaitShell(Ejecutable, Argumentos:string; Visibilidad:integer; Forms: TForm): String;
Function CopyProgSimple(Origen: String; Destino: String; ErrorNoCopiado: String): String;
function CopiaTodo(Origen,Destino : String) : LongInt;
 function EjecutarEnInicio( NombrePrograma, NombreEjecutable: String;   SoloUnaVez: Boolean ): string;
Function BorraDir(Directory: String): String;
function GetVolumeID(DriveChar: Char): String;
function GetFileDate(TheFileName: string): string;
function GetWindowsDirectory : String;
function GetSystemDirectory : String;
function GetCurrentDirectory: String;
function GetTemporalDirectory: String;
function ObtienePath(De:String):string;
function IntToHex1( n:integer ):string;
function HextoInt(HexStr:string):integer;
function IsEMail(EMail: string): Boolean;
function ValRut(Rut: String):String;
function DelFile(Archivo: String):String;
function Encrypt(const S: String; Key: Word): String;
function Decrypt(const S: String; Key: Word): String;
function TransformStr(QueCambio:String; Strings: String; Por: Char) : String;
function stripped(stripchar : char; str : string) : string;
function  GetAppInfo(De:string; fName: string):string;
function HextoIntAdv(HexStr:string; Number, Number1: Integer):integer;
function Say(S: String; Left, Top: Integer; Forms: TForm): String;
function WriteIni(Titulo: String; NomVar: String;Value: String; FileNam: String): String;
function ReadIni(Titulo: String; NomVar: String; Default: String; FileNam: String): String;
function CenterInClient(Obj:TControl; Const ObjRef:TControl): String;
FUNCTION DeleteFilesOfFolder(CONST Folder: TFileName): BOOLEAN;
function GetToken(Cadena:string; Separador:char; Token:integer):string; overload
function DOSWriteLn(S: String): String;
function DOSPause(Miliseconds: Integer): String;
function DosLimpiar: boolean;
function BorrarLetraConRuta(Letra: Char): Boolean;
function AsociarLetraConRuta(Letra: Char; Ruta: String): Boolean;
function ParpadeamiAPP(): String;
function ReiniciarApp: String;
function LeeRegRemote(UNCName: string): string;
function GetUserName : String;
function GetComputerName : String;
function IP_Publica:string;
function VaciaPapelera(): String;

 const
         C1 = 52845;
         C2 = 11719;




implementation


function VaciaPapelera(): String;

  type
    TSHEmptyRecycleBin = function (Wnd: HWND;
                                   LPCTSTR: PChar;
                                   DWORD: Word): integer; stdcall;
  var
    MangoLib           : THandle;
    SHEmptyRecycleBin  : TSHEmptyRecycleBin;
  begin
     {Cargamos SHell32.DLL}
     {Load Shell32.DLL}
     MangoLib := LoadLibrary(PChar('Shell32.dll'));

     {Si no se pudo... error}
     {if not... error}
     if MangoLib = 0 then
       Raise Exception.Create( 'No se pudo cargar Shell32.DLL'+#13+
                               'Cannot load Shell32.DLL');

     {Buscamos dentro de la DLL la funcion que queremos}
     {Search into DLL the required funtion}
     @SHEmptyRecycleBin := GetProcAddress(MangoLib, 'SHEmptyRecycleBinA');

     {Si no existe... error}
     {If don't exists... error}
     if @SHEmptyRecycleBin = nil then
     begin
       FreeLibrary(MangoLib);
       Raise Exception.Create( 'No se pudo encontrar SHEmptyRecycleBinA en Shell32.DLL'+#13+
                               'Cannot find SHEmptyRecycleBinA in Shell32.DLL');
     end;

    {Vaciamos la papelera, sin sonido ni confirmación}
    {Empty the Recycle bin...}
    SHEmptyRecycleBin(Application.Handle,'',7);

    {Liberamos la DLL}
    {Free the DLL}
    FreeLibrary(MangoLib);
  end;
...........etc.................
estoy ocupando los componentes RemObjects Pascal Srcipt, ocupe el porgrama que viene con ese "PSUnitImporter", me creó esta unidad:
"uPSI_Max.pas"
y tiene:

Código Delphi [-]
unit uPSI_Max;
{
This file has been generated by UnitParser v0.7, written by M. Knight
and updated by NP. v/d Spek and George Birbilis. 
Source Code from Carlo Kok has been used to implement various sections of
UnitParser. Components of ROPS are used in the construction of UnitParser,
code implementing the class wrapper is taken from Carlo Kok's conv utility

}
interface
 
uses
   SysUtils
  ,Classes
  ,uPSComponent
  ,uPSRuntime
  ,uPSCompiler
  ;
 
type 
(*----------------------------------------------------------------------------*)
  TPSImport_Max = class(TPSPlugin)
  protected
    procedure CompileImport1(CompExec: TPSScript); override;
    procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override;
  end;
 
 
{ compile-time registration functions }
procedure SIRegister_Max(CL: TPSPascalCompiler);

{ run-time registration functions }
procedure RIRegister_Max_Routines(S: TPSExec);

procedure Register;

implementation


uses
   Windows
  ,Messages
  ,Variants
  ,Graphics
  ,Controls
  ,Forms
  ,Dialogs
  ,StdCtrls
  ,Gauges
  ,Registry
  ,ShlObj
  ,ActiveX
  ,IdHTTP
  ,WinInet
  ,ComObj
  ,ShellApi
  ,IniFiles
  ,Max
  ;
 
 
procedure Register;
begin
  RegisterComponents('Pascal Script', [TPSImport_Max]);
end;

(* === compile-time registration functions === *)
(*----------------------------------------------------------------------------*)
procedure SIRegister_Max(CL: TPSPascalCompiler);
begin
 CL.AddDelphiFunction('Function ShowMessage1( Text : String; Tipo : TMsgDlgType) : String');
 CL.AddDelphiFunction('Function Delay( msecs : integer) : Integer');
 CL.AddDelphiFunction('Function CopyProg( Origen1, Destino1, NameFile : String; Gauges : TGauge; Labels : TLabel) : String');
 CL.AddDelphiFunction('Function CopyLista( Archivo : String; NArchivoTot : Integer; Destino : String; Gauges : TGauge; Labels : TLabel; Forms : TForm) : String');
 CL.AddDelphiFunction('Function LineasVisibles( Memo : TMemo) : integer');
 CL.AddDelphiFunction('Function LeeReg( RootKeys : HKEY; Key : String; NameValue : String) : String');
 CL.AddDelphiFunction('Function CreaReg( RootKeys : HKEY; Key : String; NameValue : String; Value : String) : String');
 CL.AddDelphiFunction('Function DelKey( RootKeys : HKEY; Key : String) : String');
 CL.AddDelphiFunction('Function IfReg( RootKeys : HKEY; Key : String; ValueExists1 : String) : Boolean');
 CL.AddDelphiFunction('Function CreaDir( Directory : String) : String');
 CL.AddDelphiFunction('Function DeleteDir( Directory : String) : String');
 CL.AddDelphiFunction('Function SelectDir( Directory : String) : String');
 CL.AddDelphiFunction('Function CreaLnk( Exe, Argumentos, DirTrabajo, NombreLnk, DirDestino : string) : String');
 CL.AddDelphiFunction('Function EjecutaExe( Exe : String; Forms : TForm) : String');
 CL.AddDelphiFunction('Function RunAndWaitShell( Ejecutable, Argumentos : string; Visibilidad : integer; Forms : TForm) : String');
 CL.AddDelphiFunction('Function CopyProgSimple( Origen : String; Destino : String; ErrorNoCopiado : String) : String');
 CL.AddDelphiFunction('Function CopiaTodo( Origen, Destino : String) : LongInt');
 CL.AddDelphiFunction('Function EjecutarEnInicio( NombrePrograma, NombreEjecutable : String; SoloUnaVez : Boolean) : string');
 CL.AddDelphiFunction('Function BorraDir( Directory : String) : String');
 CL.AddDelphiFunction('Function GetVolumeID( DriveChar : Char) : String');
 CL.AddDelphiFunction('Function GetFileDate( TheFileName : string) : string');
 CL.AddDelphiFunction('Function GetWindowsDirectory : String');
 CL.AddDelphiFunction('Function GetSystemDirectory : String');
 CL.AddDelphiFunction('Function GetCurrentDirectory : String');
 CL.AddDelphiFunction('Function GetTemporalDirectory : String');
 CL.AddDelphiFunction('Function ObtienePath( De : String) : string');
 CL.AddDelphiFunction('Function IntToHex1( n : integer) : string');
 CL.AddDelphiFunction('Function HextoInt( HexStr : string) : integer');
 CL.AddDelphiFunction('Function IsEMail( EMail : string) : Boolean');
 CL.AddDelphiFunction('Function ValRut( Rut : String) : String');
 CL.AddDelphiFunction('Function DelFile( Archivo : String) : String');
 CL.AddDelphiFunction('Function Encrypt( const S : String; Key : Word) : String');
 CL.AddDelphiFunction('Function Decrypt( const S : String; Key : Word) : String');
 CL.AddDelphiFunction('Function TransformStr( QueCambio : String; Strings : String; Por : Char) : String');
 CL.AddDelphiFunction('Function stripped( stripchar : char; str : string) : string');
 CL.AddDelphiFunction('Function GetAppInfo( De : string; fName : string) : string');
 CL.AddDelphiFunction('Function HextoIntAdv( HexStr : string; Number, Number1 : Integer) : integer');
 CL.AddDelphiFunction('Function Say( S : String; Left, Top : Integer; Forms : TForm) : String');
 CL.AddDelphiFunction('Function WriteIni( Titulo : String; NomVar : String; Value : String; FileNam : String) : String');
 CL.AddDelphiFunction('Function ReadIni( Titulo : String; NomVar : String; Default : String; FileNam : String) : String');
 CL.AddDelphiFunction('Function CenterInClient( Obj : TControl; const ObjRef : TControl) : String');
 CL.AddDelphiFunction('Function DeleteFilesOfFolder( const Folder : TFileName) : BOOLEAN');
 CL.AddDelphiFunction('Function DOSWriteLn( S : String) : String');
 CL.AddDelphiFunction('Function DOSPause( Miliseconds : Integer) : String');
 CL.AddDelphiFunction('Function DosLimpiar : boolean');
 CL.AddDelphiFunction('Function BorrarLetraConRuta( Letra : Char) : Boolean');
 CL.AddDelphiFunction('Function AsociarLetraConRuta( Letra : Char; Ruta : String) : Boolean');
 CL.AddDelphiFunction('Function ParpadeamiAPP( ) : String');
 CL.AddDelphiFunction('Function ReiniciarApp : String');
 CL.AddDelphiFunction('Function LeeRegRemote( UNCName : string) : string');
 CL.AddDelphiFunction('Function GetUserName : String');
 CL.AddDelphiFunction('Function GetComputerName : String');
 CL.AddDelphiFunction('Function IP_Publica : string');
 CL.AddDelphiFunction('Function VaciaPapelera( ) : String');
 CL.AddConstantN('C1','LongInt').SetInt( 52845);
 CL.AddConstantN('C2','LongInt').SetInt( 11719);
end;

(* === run-time registration functions === *)
(*----------------------------------------------------------------------------*)
procedure RIRegister_Max_Routines(S: TPSExec);
begin
 S.RegisterDelphiFunction(@ShowMessage1, 'ShowMessage1', cdRegister);
 S.RegisterDelphiFunction(@Delay, 'Delay', cdRegister);
 S.RegisterDelphiFunction(@CopyProg, 'CopyProg', cdRegister);
 S.RegisterDelphiFunction(@CopyLista, 'CopyLista', cdRegister);
 S.RegisterDelphiFunction(@LineasVisibles, 'LineasVisibles', cdRegister);
 S.RegisterDelphiFunction(@LeeReg, 'LeeReg', cdRegister);
 S.RegisterDelphiFunction(@CreaReg, 'CreaReg', cdRegister);
 S.RegisterDelphiFunction(@DelKey, 'DelKey', cdRegister);
 S.RegisterDelphiFunction(@IfReg, 'IfReg', cdRegister);
 S.RegisterDelphiFunction(@CreaDir, 'CreaDir', cdRegister);
 S.RegisterDelphiFunction(@DeleteDir, 'DeleteDir', cdRegister);
 S.RegisterDelphiFunction(@SelectDir, 'SelectDir', cdRegister);
 S.RegisterDelphiFunction(@CreaLnk, 'CreaLnk', cdRegister);
 S.RegisterDelphiFunction(@EjecutaExe, 'EjecutaExe', cdRegister);
 S.RegisterDelphiFunction(@RunAndWaitShell, 'RunAndWaitShell', cdRegister);
 S.RegisterDelphiFunction(@CopyProgSimple, 'CopyProgSimple', cdRegister);
 S.RegisterDelphiFunction(@CopiaTodo, 'CopiaTodo', cdRegister);
 S.RegisterDelphiFunction(@EjecutarEnInicio, 'EjecutarEnInicio', cdRegister);
 S.RegisterDelphiFunction(@BorraDir, 'BorraDir', cdRegister);
 S.RegisterDelphiFunction(@GetVolumeID, 'GetVolumeID', cdRegister);
 S.RegisterDelphiFunction(@GetFileDate, 'GetFileDate', cdRegister);
 S.RegisterDelphiFunction(@GetWindowsDirectory, 'GetWindowsDirectory', cdRegister);
 S.RegisterDelphiFunction(@GetSystemDirectory, 'GetSystemDirectory', cdRegister);
 S.RegisterDelphiFunction(@GetCurrentDirectory, 'GetCurrentDirectory', cdRegister);
 S.RegisterDelphiFunction(@GetTemporalDirectory, 'GetTemporalDirectory', cdRegister);
 S.RegisterDelphiFunction(@ObtienePath, 'ObtienePath', cdRegister);
 S.RegisterDelphiFunction(@IntToHex1, 'IntToHex1', cdRegister);
 S.RegisterDelphiFunction(@HextoInt, 'HextoInt', cdRegister);
 S.RegisterDelphiFunction(@IsEMail, 'IsEMail', cdRegister);
 S.RegisterDelphiFunction(@ValRut, 'ValRut', cdRegister);
 S.RegisterDelphiFunction(@DelFile, 'DelFile', cdRegister);
 S.RegisterDelphiFunction(@Encrypt, 'Encrypt', cdRegister);
 S.RegisterDelphiFunction(@Decrypt, 'Decrypt', cdRegister);
 S.RegisterDelphiFunction(@TransformStr, 'TransformStr', cdRegister);
 S.RegisterDelphiFunction(@stripped, 'stripped', cdRegister);
 S.RegisterDelphiFunction(@GetAppInfo, 'GetAppInfo', cdRegister);
 S.RegisterDelphiFunction(@HextoIntAdv, 'HextoIntAdv', cdRegister);
 S.RegisterDelphiFunction(@Say, 'Say', cdRegister);
 S.RegisterDelphiFunction(@WriteIni, 'WriteIni', cdRegister);
 S.RegisterDelphiFunction(@ReadIni, 'ReadIni', cdRegister);
 S.RegisterDelphiFunction(@CenterInClient, 'CenterInClient', cdRegister);
 S.RegisterDelphiFunction(@DeleteFilesOfFolder, 'DeleteFilesOfFolder', cdRegister);
 S.RegisterDelphiFunction(@DOSWriteLn, 'DOSWriteLn', cdRegister);
 S.RegisterDelphiFunction(@DOSPause, 'DOSPause', cdRegister);
 S.RegisterDelphiFunction(@DosLimpiar, 'DosLimpiar', cdRegister);
 S.RegisterDelphiFunction(@BorrarLetraConRuta, 'BorrarLetraConRuta', cdRegister);
 S.RegisterDelphiFunction(@AsociarLetraConRuta, 'AsociarLetraConRuta', cdRegister);
 S.RegisterDelphiFunction(@ParpadeamiAPP, 'ParpadeamiAPP', cdRegister);
 S.RegisterDelphiFunction(@ReiniciarApp, 'ReiniciarApp', cdRegister);
 S.RegisterDelphiFunction(@LeeRegRemote, 'LeeRegRemote', cdRegister);
 S.RegisterDelphiFunction(@GetUserName, 'GetUserName', cdRegister);
 S.RegisterDelphiFunction(@GetComputerName, 'GetComputerName', cdRegister);
 S.RegisterDelphiFunction(@IP_Publica, 'IP_Publica', cdRegister);
 S.RegisterDelphiFunction(@VaciaPapelera, 'VaciaPapelera', cdRegister);
end;

 
 
{ TPSImport_Max }
(*----------------------------------------------------------------------------*)
procedure TPSImport_Max.CompileImport1(CompExec: TPSScript);
begin
  SIRegister_Max(CompExec.Comp);
end;
(*----------------------------------------------------------------------------*)
procedure TPSImport_Max.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter);
begin
  RIRegister_Max(ri);
  RIRegister_Max_Routines(CompExec.Exec); // comment it if no routines
end;
(*----------------------------------------------------------------------------*)
 
 
end.

pero al compilarla, me da error en la que está marcado con negrita y subrayado: " RIRegister_Max(ri);"

¿Que puede ser?

Gracias.

54LU2
Responder Con Cita