* * * *

Privacy Policy

Blog italiano

Clicca qui se vuoi andare al blog italiano su Lazarus e il pascal.

Forum ufficiale

Se non siete riusciti a reperire l'informazione che cercavate nei nostri articoli o sul nostro forum vi consiglio di visitare il
Forum ufficiale di Lazarus in lingua inglese.

Lazarus 1.0

Trascinare un file nel programma
DB concetti fondamentali e ZeosLib
Recuperare codice HTML da pagina web
Mandare mail con Lazarus
Stabilire il sistema operativo
Esempio lista in pascal
File INI
Codice di attivazione
Realizzare programmi multilingua
Lavorare con le directory
Utilizzare Unità esterne
TTreeView
TTreeview e Menu
Generare controlli RUN-TIME
LazReport, PDF ed immagini
Intercettare tasti premuti
Ampliare Lazarus
Lazarus e la crittografia
System Tray con Lazarus
UIB: Unified Interbase
Il file: questo sconosciuto
Conferma di chiusura di un applicazione
Liste e puntatori
Overload di funzioni
Funzioni a parametri variabili
Proprietà
Conversione numerica
TImage su Form e Panel
Indy gestiore server FTP lato Client
PopUpMenu sotto Pulsante (TSpeedButton)
Direttiva $macro
Toolbar
Evidenziare voci TreeView
Visualizzare un file Html esterno
StatusBar - aggirare l'errore variabile duplicata
Da DataSource a Excel
Le permutazioni
Brute force
Indy 10 - Invio email con allegati
La gestione degli errori in Lazarus
Pascal Script
Linux + Zeos + Firebird
Dataset virtuale
Overload di operatori
Lavorare con file in formato JSON con Lazarus
Zeos ... dietro le quinte (prima parte)
Disporre le finestre in un blocco unico (come Delphi)
Aspetto retrò (Cmd Line)
Lazarus 1.0
Come interfacciare periferica twain
Ubuntu - aggiornare free pascal e lazarus
fpcup: installazioni parallele di lazarus e fpc
Free Pascal e Lazarus sul Raspberry Pi
Cifratura: breve guida all'uso dell'algoritmo BlowFish con lazarus e free pascal.
Creare un server multithread
guida all'installazione di fpc trunk da subversion in linux gentoo
Indice
DB concetti fondamentali e connessioni standard
Advanced Record Syntax
DB concetti fondamentali e DBGrid
DB concetti fondamentali e TDBEdit, TDBMemo e TDBText
Advanced Record Syntax: un esempio pratico
Superclasse form base per programmi gestionali (e non)
Superclasse form base per programmi gestionali (e non) #2 - log, exception call stack, application toolbox
Superclasse form base per programmi gestionali (e non) #3 - traduzione delle form
Superclasse form base per programmi gestionali (e non) #4 - wait animation
Un dialog per la connessione al database:TfmSimpleDbConnectionDialog
Installare lazarus su mac osx sierra
immagine docker per lavorare con lazarus e free pascal
TDD o Test-Driven Development
Benvenuto! Effettua l'accesso oppure registrati.
Aprile 16, 2024, 07:48:17 am

Inserisci il nome utente, la password e la durata della sessione.

74 Visitatori, 0 Utenti

Autore Topic: DLL per salvare e richiamare file txt.  (Letto 61941 volte)

Simon75

  • Full Member
  • ***
  • Post: 139
  • Karma: +0/-0
DLL per salvare e richiamare file txt.
« il: Gennaio 01, 2013, 01:23:56 am »
Salve Signori  :)  quello che devo fare è dire alla SaveDialog di salvare quello che scrivo dentro le caselle nere e poi dire a OpenDialog di caricare il file di testo salvato con SaveDialog.
Non fate caso a ADD e PART loro fanno il loro lavoro poichè ADD mi genera la stringa creata da me nelle caselle nere ovvero le aggiunge e PART le divide in poche parole ho bisogno di un terzo ingresso che mi legga la riga di testo che esce da ADD $  e penso di usare un semplice read per tale scopo e un uscita con write che andra sull'ingresso $ di PART.
Posso usare assieme:

Codice: [Seleziona]
     

type TDLLParams = array[0..100] of extended;
     PDLLParams = ^TDLLParams;


type TStringParams = array[0..100] of PChar;
     PStringParams = ^TStringParams;


Anche perché dice questo:

The procedure CALCULATE is called repeatedly while ProfiLab is in RUN mode, to hand out new input values to the DLL and to request new output values from the DLL. This means that this procedure must be programmed as short as possible, and must not contain any pauses (WAIT loops or SLEEP commands) that waste time. After reading input values and setting new output vaues this routine should be terminated as soon as possible. The time spent in this procedure will directly influence the simulation frequency of ProfiLab.
 
Codice: [Seleziona]
Procedure CalculateEx(PInput,POutput,PUser: PDLLParams; PStrings: PStringParams);

This method was introduced to allow string processing with DLL´s. It may be used as alternative for CALCULATE. Parameter PSTRINGS were added for interfacing string data. Its Delphi delclaration is as follows:
 
Codice: [Seleziona]
type TStringParams = array[0..100] of PChar;
     PStringParams = ^TStringParams;



Each input/output (max. 100) has a null-terminated character pointer (PChar) assigned, which points to a memory space that is provided by ProfiLab. Right before ProfiLab enters the method, data is fetched from the $inputs. After leaving the method data is handed out through the $outputs. It is not distinguished between inputs and outputs. This means that Input 0 and Output 0 for example share the same PChar. To make a pin become a string input or string output its pin name must be declared with a leading '$' character. Examples for string processing with DLL´s and ProfiLab are available.
 


Ringrazio

Codice: [Seleziona]

library dialog;

{$mode objfpc}{$H+}

uses
  Interfaces,
  Classes,
  SysUtils,
  Windows,
  FileUtil,
  Forms,
  Controls,
  Graphics,
  Dialogs;

const
  Inputs = 3;  // quantita entrata
  Outputs = 1; // quantita uscita

  {INPUTS}// nome per numero di entrata
  I0 = 0;  // valore I0 = PInput[I0] ossia PInput[0]
  I1 = 1;  // valore I1 = PInput[I1] ossia PInput[1]
  $read = 2;
  // I3 = 3;
  // ... I99 = 99;

  {OUTPUTS}// nome per numero di uscita
  $write = 0;  // valore Q0 = POutput[Q0] ossia POutput[0]
  //Q1 = 1;  // valore Q1 = POutput[Q1] ossia POutput[1]

  // Q3 = 3;
  // ... Q99 = 99;

  {USER}// nome per numero di variabile, I valori vengono memorizzati

  U0 = 0; // valore U0 = PUser[U0] ossia PUser[0]
  // U1 = 1;
  // U2 = 2;
  // U3 = 3;
  // ... U99 = 99;

  // I0,I1,I2,I3,Q0,Q1,Q2,Q3,U0,U1,U2,U3
  // I nomi possono essere qualsiasi, sono case-insensitive
var
  globalDialog: TFileDialog;

type
  TDLLParams = array[0..100] of extended; //Type of ProfiLab DLL parameters
  PDLLParams = ^TDLLParams;               // Pointer to ProfiLab DLL parameters

  TStringParams = array[0..100] of PChar;
     PStringParams = ^TStringParams;


  function ApriSaveDialog: ShortString;
  begin
    result := '';
    if not assigned(globalDialog) then
    begin
      globalDialog := TSaveDialog.Create(nil);
      try
        globalDialog.Filter := '*.txt';
        if globalDialog.Execute then
          Result := globalDialog.FileName
        else
          Result := '';
      finally
        FreeAndNil(globalDialog);
      end;
    end;
  end;

  function ApriOpenDialog: ShortString;
  begin
    result := '';
    if not assigned(globalDialog) then
    begin
      globalDialog := TOpenDialog.Create(nil);
      try
        globalDialog.Filter := '*.txt';
        if globalDialog.Execute then
          Result := globalDialog.FileName
        else
          Result := '';
      finally
        FreeAndNil(globalDialog);
      end;
    end;
  end;

  function NumInputs: byte;
  begin
    Result := Inputs; // trasferire quantita entrata
  end;

  function NumOutputs: byte;
  begin
    Result := Outputs; // trasferire quantita uscita
  end;

  function InputName(Channel: byte): ShortString; // trasferire nome di entrata
  begin
    case Channel of
      I0: Result := 'I0'; // nome di pin I0
      I1: Result := 'I1'; // nome di pin I1
      $read: Result:='$read';
    end;
  end;

  function OutputName(Channel: byte): ShortString; // trasferire nome di uscita
  begin
    case Channel of
      $write: Result := '$write'; // nome di pin Q0
      //Q1: Result := 'Q1'; // nome di pin Q1
    end;
  end;


  procedure SimStart(PInput, POutput, PUser: PDLLParams); // Routine viene eseguita solo al primo avvio
  begin

  end;


  procedure Calculate(PInput, POutput, PUser: PDLLParams); // Routine è permanente
  begin
    if PInput^[I0] > 2.5 then
    begin
      if ('' <> ApriOpenDialog) then
     end;
      if PInput^[I1] > 2.5 then
    begin
      if ('' <> ApriSaveDialog) then
       end;
       end;
Procedure CalculateEx(PInput,POutput,PUser: PDLLParams; PStrings: PStringParams);


begin

PInput^[$read]:=read;

POutput^[$write]:=write;


end;


  procedure SimStop(PInput, POutput, PUser: PDLLParams); // Routine viene eseguita solo in fase di chiusura
  begin

  end;


  //export methods for ProfiLab
exports
  SimStart,
  SimStop,
  NumInputs,
  NumOutputs,
  Calculate,
  InputName,
  OutputName,
  ApriOpenDialog,
  ApriSaveDialog;
begin
end.
             


Attualmente mi genera questo errore:
Codice: [Seleziona]


project1.lpr(24,3) Fatal: Syntax error, "BEGIN" expected but "ordinal const" found






« Ultima modifica: Gennaio 01, 2013, 02:26:37 am da Simon75 »
A volte bisogna commettere errori per capire qual è la cosa giusta da fare...

Const
Errori=Esperienza

Stilgar

  • Global Moderator
  • Hero Member
  • *****
  • Post: 2382
  • Karma: +10/-0
Re:DLL per salvare e richiamare file txt.
« Risposta #1 il: Gennaio 01, 2013, 12:11:56 pm »
Codice: [Seleziona]
  $read = 2;
  // I3 = 3;
  // ... I99 = 99;

  {OUTPUTS}// nome per numero di uscita
  $write = 0;  // valore Q0 = POutput[Q0] ossia POutput[0]       
Ciao,
 il problema è l'uso del carattere $ ...
Non è un carattere valido per gli identificatori.
Se lo usi davanti ai numeri ottieni che il compilatore non interpreta le cifre in decimale ma in esadecimale.
Il "#" viene usato per definire i caratteri via decimale o "#$" in esadecimale.

In altri linguaggi il $ viene utilizzato come carattere per gli identificatori. Non il pascal (non mi risulta nemmeno Java e C/C++ permettano di usarlo).

Ciao e buon anno
Stilgar
Al mondo ci sono 10 tipi di persone ... chi capisce il binario e chi no.

Simon75

  • Full Member
  • ***
  • Post: 139
  • Karma: +0/-0
Re:DLL per salvare e richiamare file txt.
« Risposta #2 il: Gennaio 01, 2013, 02:38:09 pm »
OK, ora in queste condizioni mi genera senza errori la DLL ma ora rimane il problema che devo dire a SaveDialog di salvare quello che scrivo nelle caselle nere e dire a OpenDialog di cercare il file salvato che mi serve da caricare nelle caselle grigie.
 ;)

Codice: [Seleziona]


library dialog;

{$mode objfpc}{$H+}

uses
  Interfaces,
  Classes,
  SysUtils,
  Windows,
  FileUtil,
  Forms,
  Controls,
  Graphics,
  Dialogs;

const
  Inputs = 3;  // quantita entrata
  Outputs = 1; // quantita uscita

  {INPUTS}// nome per numero di entrata
  I0 = 0;  // valore I0 = PInput[I0] ossia PInput[0]
  I1 = 1;  // valore I1 = PInput[I1] ossia PInput[1]
  read = 2;
  // I3 = 3;
  // ... I99 = 99;

  {OUTPUTS}// nome per numero di uscita
  write = 0;  // valore Q0 = POutput[Q0] ossia POutput[0]
  //Q1 = 1;  // valore Q1 = POutput[Q1] ossia POutput[1]

  // Q3 = 3;
  // ... Q99 = 99;

  {USER}// nome per numero di variabile, I valori vengono memorizzati

  U0 = 0; // valore U0 = PUser[U0] ossia PUser[0]
  // U1 = 1;
  // U2 = 2;
  // U3 = 3;
  // ... U99 = 99;

  // I0,I1,I2,I3,Q0,Q1,Q2,Q3,U0,U1,U2,U3
  // I nomi possono essere qualsiasi, sono case-insensitive
var
  globalDialog: TFileDialog;

type
  TDLLParams = array[0..100] of extended; //Type of ProfiLab DLL parameters
  PDLLParams = ^TDLLParams;               // Pointer to ProfiLab DLL parameters

  TStringParams = array[0..100] of PChar;
     PStringParams = ^TStringParams;


  function ApriSaveDialog: ShortString;
  begin
    result := '';
    if not assigned(globalDialog) then
    begin
      globalDialog := TSaveDialog.Create(nil);
      try
        globalDialog.Filter := '*.txt';
        if globalDialog.Execute then
          Result := globalDialog.FileName
        else
          Result := '';
      finally
        FreeAndNil(globalDialog);
      end;
    end;
  end;

  function ApriOpenDialog: ShortString;
  begin
    result := '';
    if not assigned(globalDialog) then
    begin
      globalDialog := TOpenDialog.Create(nil);
      try
        globalDialog.Filter := '*.txt';
        if globalDialog.Execute then
          Result := globalDialog.FileName
        else
          Result := '';
      finally
        FreeAndNil(globalDialog);
      end;
    end;
  end;

  function NumInputs: byte;
  begin
    Result := Inputs; // trasferire quantita entrata
  end;

  function NumOutputs: byte;
  begin
    Result := Outputs; // trasferire quantita uscita
  end;

  function InputName(Channel: byte): ShortString; // trasferire nome di entrata
  begin
    case Channel of
      I0: Result := 'I0'; // nome di pin I0
      I1: Result := 'I1'; // nome di pin I1
      read: Result:='$read';
    end;
  end;

  function OutputName(Channel: byte): ShortString; // trasferire nome di uscita
  begin
    case Channel of
      write: Result := '$write'; // nome di pin Q0
      //Q1: Result := 'Q1'; // nome di pin Q1
    end;
  end;


  procedure SimStart(PInput, POutput, PUser: PDLLParams); // Routine viene eseguita solo al primo avvio
  begin

  end;


  procedure Calculate(PInput, POutput, PUser: PDLLParams); // Routine è permanente
  begin
    if PInput^[I0] > 2.5 then
    begin
      if ('' <> ApriOpenDialog) then
     end;
      if PInput^[I1] > 2.5 then
    begin
      if ('' <> ApriSaveDialog) then
       end;
       end;
Procedure CalculateEx(PInput,POutput,PUser: PDLLParams; PStrings: PStringParams);


begin

PInput^[read]:=read;

POutput^[write]:=write;


end;


  procedure SimStop(PInput, POutput, PUser: PDLLParams); // Routine viene eseguita solo in fase di chiusura
  begin

  end;


  //export methods for ProfiLab
exports
  SimStart,
  SimStop,
  NumInputs,
  NumOutputs,
  Calculate,
  InputName,
  OutputName,
  ApriOpenDialog,
  ApriSaveDialog;
begin
end.
         



Codice: [Seleziona]

 
 if ApriSaveDialog.Execute then
    PInput^[read].Lines.SaveToFile( ApriSaveDialog.Filename );
 end;

if ApriOpenDialog.Execute then
    POutput^[write].Lines.LoadToFile( ApriOpenDialog.Filename );
 end;


Dovrebbe uscire cosi giusto?
E dovrei metterlo in Calculate
« Ultima modifica: Gennaio 01, 2013, 02:40:24 pm da Simon75 »
A volte bisogna commettere errori per capire qual è la cosa giusta da fare...

Const
Errori=Esperienza

nomorelogic

  • Global Moderator
  • Hero Member
  • *****
  • Post: 2870
  • Karma: +20/-4
Re:DLL per salvare e richiamare file txt.
« Risposta #3 il: Gennaio 01, 2013, 02:45:13 pm »

if ApriOpenDialog.Execute then
    POutput^[write].Lines.LoadToFile( ApriOpenDialog.Filename );
 end;


a patto che LoadToFile diventi LoadFromFile, si può anche provare ;)
Imagination is more important than knowledge (A.Einstein)

Simon75

  • Full Member
  • ***
  • Post: 139
  • Karma: +0/-0
Re:DLL per salvare e richiamare file txt.
« Risposta #4 il: Gennaio 01, 2013, 03:03:41 pm »
Mi genera questo Errori:

Codice: [Seleziona]

project1.lpr(120,22) Hint: Parameter "PInput" not used
project1.lpr(120,30) Hint: Parameter "POutput" not used
project1.lpr(120,39) Hint: Parameter "PUser" not used
project1.lpr(133,20) Error: Illegal qualifier
project1.lpr(134,19) Error: Illegal qualifier
project1.lpr(134,52) Error: Illegal qualifier
project1.lpr(137,19) Error: Illegal qualifier
project1.lpr(138,12) Error: Identifier not found "POutput"
project1.lpr(138,56) Error: Illegal qualifier
project1.lpr(139,5) Fatal: Syntax error, "." expected but ";" found


Codice: [Seleziona]

procedure Calculate(PInput, POutput, PUser: PDLLParams); // Routine è permanente



begin

 if ApriSaveDialog.Execute then
    PInput^[read].Lines.SaveToFile( ApriSaveDialog.Filename );
 end;
begin
if ApriOpenDialog.Execute then
    POutput^[write].Lines.LoadFromFile( ApriOpenDialog.Filename );
 end;

 if PInput^[I0] > 2.5 then
    begin
      if ('' <> ApriOpenDialog) then
     end;
      if PInput^[I1] > 2.5 then

begin
      if ('' <> ApriSaveDialog) then

       end;
       end;

Procedure CalculateEx(PInput,POutput,PUser: PDLLParams; PStrings: PStringParams);


begin

PInput^[read]:=read;

POutput^[write]:=write;


end; 


Avete qualche idea???
A volte bisogna commettere errori per capire qual è la cosa giusta da fare...

Const
Errori=Esperienza

nomorelogic

  • Global Moderator
  • Hero Member
  • *****
  • Post: 2870
  • Karma: +20/-4
Re:DLL per salvare e richiamare file txt.
« Risposta #5 il: Gennaio 01, 2013, 03:21:24 pm »
c'è un po' di confusione nei begin/end e soprattutto le identazioni lasciano a desiderare e diventa più difficile capire cosa volevi scrivere :)

ad esempio cambia l'inizio come sotto e poi dai una sistemata anche al resto ;)

Codice: [Seleziona]

procedure Calculate(PInput, POutput, PUser: PDLLParams); // Routine è permanente
begin

if ApriSaveDialog.Execute then
    PInput^[read].Lines.SaveToFile( ApriSaveDialog.Filename );

if ApriOpenDialog.Execute then
    POutput^[write].Lines.LoadFromFile( ApriOpenDialog.Filename );



Imagination is more important than knowledge (A.Einstein)

Simon75

  • Full Member
  • ***
  • Post: 139
  • Karma: +0/-0
Re:DLL per salvare e richiamare file txt.
« Risposta #6 il: Gennaio 01, 2013, 06:30:55 pm »
Cosa cavolo sto sbagliando  :o mi metto a piangere adesso  :'(   :)

Codice: [Seleziona]

project1.lpr(120,22) Hint: Parameter "PInput" not used
project1.lpr(120,30) Hint: Parameter "POutput" not used
project1.lpr(120,39) Hint: Parameter "PUser" not used
project1.lpr(127,29) Hint: Parameter "POutput" not used
project1.lpr(127,38) Hint: Parameter "PUser" not used
project1.lpr(147,25) Error: Illegal qualifier
project1.lpr(148,25) Error: Illegal qualifier
project1.lpr(148,58) Error: Illegal qualifier
project1.lpr(151,25) Error: Illegal qualifier
project1.lpr(152,27) Error: Illegal qualifier
project1.lpr(152,62) Error: Illegal qualifier
project1.lpr(182) Fatal: There were 6 errors compiling module, stopping



Codice: [Seleziona]


procedure Calculate(PInput, POutput, PUser: PDLLParams); // Routine è permanente

begin

if PInput^[I0] > 2.5 then
    begin
      if ('' <> ApriOpenDialog) then
     end;
      if PInput^[I1] > 2.5 then
     begin
      if ('' <> ApriSaveDialog) then

       end;
       end;


Procedure CalculateEx(PInput,POutput,PUser: PDLLParams; PStrings: PStringParams);


begin
      if ApriSaveDialog.Execute then
          PInput^[read].Lines.SaveToFile( ApriSaveDialog.Filename );


      if ApriOpenDialog.Execute then
          POutput^[write].Lines.LoadFromFile( ApriOpenDialog.Filename );


PInput^[read]:=read;

POutput^[write]:=write;

end;   
A volte bisogna commettere errori per capire qual è la cosa giusta da fare...

Const
Errori=Esperienza

nomorelogic

  • Global Moderator
  • Hero Member
  • *****
  • Post: 2870
  • Karma: +20/-4
Re:DLL per salvare e richiamare file txt.
« Risposta #7 il: Gennaio 01, 2013, 07:43:09 pm »
credo che il compilatore non capisca i blocchi begin/end ed effettivamente non è che si capisce cosa vuol dire:
if PInput^[I0] > 2.5 then
    begin
      if ('' <> ApriOpenDialog) then // qua c'è un "then" seguito da un "end"
     end;
      if PInput^[I1] > 2.5 then
     begin
      if ('' <> ApriSaveDialog) then // stesso errore di sopra

       end;


parti da questa versione sotto, quando compila senza errori, inserisci una istruzione alla volta. è il modo migliore per capire quando scrivi qualcosa di sbagliato ;)


Codice: [Seleziona]
procedure Calculate(PInput, POutput, PUser: PDLLParams); // Routine è permanente
begin

   if PInput^[I0] > 2.5 then
       begin
       end;

end;

Procedure CalculateEx(PInput,POutput,PUser: PDLLParams; PStrings: PStringParams);
begin
      if ApriSaveDialog.Execute then
          PInput^[read].Lines.SaveToFile( ApriSaveDialog.Filename );

      if ApriOpenDialog.Execute then
          POutput^[write].Lines.LoadFromFile( ApriOpenDialog.Filename );

      PInput^[read]:=read;

      POutput^[write]:=write;
end;   
Imagination is more important than knowledge (A.Einstein)

Stilgar

  • Global Moderator
  • Hero Member
  • *****
  • Post: 2382
  • Karma: +10/-0
Re:DLL per salvare e richiamare file txt.
« Risposta #8 il: Gennaio 01, 2013, 10:14:38 pm »
Simon, preferivo l'operazionale come avatar ;)
Al mondo ci sono 10 tipi di persone ... chi capisce il binario e chi no.

Simon75

  • Full Member
  • ***
  • Post: 139
  • Karma: +0/-0
Re:DLL per salvare e richiamare file txt.
« Risposta #9 il: Gennaio 01, 2013, 11:04:55 pm »
l'oscilloscopio per me è elettronica :)
Se non vedi i segnali che escono da un circuito come fai a quantificare le sue caratteristiche?
In laboratorio per me è il pane :)
A volte bisogna commettere errori per capire qual è la cosa giusta da fare...

Const
Errori=Esperienza

Simon75

  • Full Member
  • ***
  • Post: 139
  • Karma: +0/-0
Re:DLL per salvare e richiamare file txt.
« Risposta #10 il: Gennaio 02, 2013, 12:38:16 am »
Mi sto perdendo  :-\
Perché non compila?

Codice: [Seleziona]

project1.lpr(121,22) Hint: Parameter "PInput" not used
project1.lpr(121,30) Hint: Parameter "POutput" not used
project1.lpr(121,39) Hint: Parameter "PUser" not used
project1.lpr(128,29) Hint: Parameter "POutput" not used
project1.lpr(128,38) Hint: Parameter "PUser" not used
project1.lpr(148,25) Error: Illegal qualifier
project1.lpr(149,25) Error: Illegal qualifier
project1.lpr(149,58) Error: Illegal qualifier
project1.lpr(152,25) Error: Illegal qualifier
project1.lpr(153,27) Error: Illegal qualifier
project1.lpr(153,62) Error: Illegal qualifier
project1.lpr(183) Fatal: There were 6 errors compiling module, stopping



Codice: [Seleziona]


procedure Calculate(PInput, POutput, PUser: PDLLParams); // Routine è permanente

begin

    if PInput^[I0] > 2.5 then ApriOpenDialog;

    if PInput^[I1] > 2.5 then ApriSaveDialog;



end;




Procedure CalculateEx(PInput,POutput,PUser: PDLLParams; PStrings: PStringParams);


begin

      if ApriSaveDialog.Execute then
          PInput^[read].Lines.SaveToFile( ApriSaveDialog.Filename );


      if ApriOpenDialog.Execute then
          POutput^[write].Lines.LoadFromFile( ApriOpenDialog.Filename );


PInput^[read]:=read;

POutput^[write]:=write;

end;
A volte bisogna commettere errori per capire qual è la cosa giusta da fare...

Const
Errori=Esperienza

Stilgar

  • Global Moderator
  • Hero Member
  • *****
  • Post: 2382
  • Karma: +10/-0
Re:DLL per salvare e richiamare file txt.
« Risposta #11 il: Gennaio 02, 2013, 12:43:58 am »
Hai controllato alle righe indicate cosa c'è?
Ctrl+G
Al mondo ci sono 10 tipi di persone ... chi capisce il binario e chi no.

Simon75

  • Full Member
  • ***
  • Post: 139
  • Karma: +0/-0
Re:DLL per salvare e richiamare file txt.
« Risposta #12 il: Gennaio 02, 2013, 12:49:14 am »
mi evidenzia questi:

Codice: [Seleziona]

      if ApriSaveDialog.Execute then
          PInput^[read].Lines.SaveToFile( ApriSaveDialog.Filename );


      if ApriOpenDialog.Execute then 
A volte bisogna commettere errori per capire qual è la cosa giusta da fare...

Const
Errori=Esperienza

Stilgar

  • Global Moderator
  • Hero Member
  • *****
  • Post: 2382
  • Karma: +10/-0
Re:DLL per salvare e richiamare file txt.
« Risposta #13 il: Gennaio 02, 2013, 12:53:39 am »
Ok, allora mi viene da pensare che "read" non sia dichiarata ...
Al mondo ci sono 10 tipi di persone ... chi capisce il binario e chi no.

Stilgar

  • Global Moderator
  • Hero Member
  • *****
  • Post: 2382
  • Karma: +10/-0
Re:DLL per salvare e richiamare file txt.
« Risposta #14 il: Gennaio 02, 2013, 12:55:00 am »
Il numero di errori che ti segnala è compatibile con il fatto che read e write non siano dichiarate.
Le usi 3 volte e sono 2 variabili ... quindi i sei errori che ti segnala potrebbero essere questi.
Al mondo ci sono 10 tipi di persone ... chi capisce il binario e chi no.

 

Recenti

How To

Utenti
  • Utenti in totale: 785
  • Latest: gmax
Stats
  • Post in totale: 18769
  • Topic in totale: 2232
  • Online Today: 80
  • Online Ever: 900
  • (Gennaio 21, 2020, 08:17:49 pm)
Utenti Online
Users: 0
Guests: 74
Total: 74

Disclaimer:

Questo blog non rappresenta una testata giornalistica poiché viene aggiornato senza alcuna periodicità. Non può pertanto considerarsi un prodotto editoriale ai sensi della legge n. 62/2001.