🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.lang.basic
Article #834

PROBLEMA PER PROGRAMMATORI VB5 E DELPHI

#834
From: Alfredo Mora
Date: Sat, 30 May 1998 00:00
125 lines
3724 bytes
Ho creato in Delphi 2.0 una dll che mi permette di modificare le proprit� di
un oggetto
conosciuto che le viene passato per puntatore.
La DLL funziona se viene richiamata da un programma scritto in Delphi 2.0,
ma non se la richiamo da
un programma scritto in Visual Basic 5 in quanto si genra un errore del
tipo:
VB5 caused an invalid page fault in module VB5.exe at 014f:004e9914

Qualcuno sa darmi una spiegazione o meglio una soluzione ??

Es.  Passo alla DLL l' oggetto TEXT1 di tipo textbox(VB5) o Tedit (Delphi2)
che come unica operazione scrive nella proprit� TEXT la stringa "OK"

Il tutto funziona di da DELPHI ma non da VB5
Segue Sorgente : Prima la struttura della DLL e poi i due progetti Delphi 2
e Visual Basic 5
Che contengono entrambe nel unico Form un controllo di testo e 2 pulsanti
uno di fine e uno
di richiamo della Dll.

----------------------------------------------------------------------------
-----------
Struttura della DLL

library DllTest;
uses
  test1 in 'test1.pas'
exports
      l_l;
begin
end.

unit test1;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls,OleCtrls;
type
  Ttest = class(TForm)
    Label1: TLabel;
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
   test :ttest;
procedure l_l(t1 : pointer) stdcall; export;
implementation
{$R *.DFM}
procedure l_l(t1:POINTER);
var
   t2 : TEdit;
begin
   t2 := tedit(t1);
   t2.text := 'ok';
end;


----------------------------------------------------------------------------
-----------
Struttura del programma in Delphi

program Project1;
uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};
{$R *.RES}
begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.


unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, OleCtrls;
  procedure l_l(t1: pointer) stdcall;external 'DllTest.dll';
type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
     close;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
     l_l(edit1);
end;
end.


----------------------------------------------------------------------------
-----------
Struttura del programma in Visual basic

(Modulo1.bas)
Option Explicit
Declare Sub l_l Lib "DllTest.dll" (ByVal t1 As Any)
(Form1.frm)
Option Explicit
Private Sub Command1_Click()
    End
End Sub
Private Sub Command2_Click()
   l_l Text1
End Sub
Technical Details
Message-ID: <6kplsd$ntk@everest.vol.it>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ITALIAN,ASCII
X-Google-Thread: 110820,c0ddc6be4555af4a,start
X-Google-Attributes: gid110820,public
X-Google-Thread: 10d326,c0ddc6be4555af4a,start
X-Google-Attributes: gid10d326,public
X-Google-Thread: f973d,c0ddc6be4555af4a,start
X-Google-Attributes: gidf973d,public
X-Google-Thread: 10ab99,c0ddc6be4555af4a,start
X-Google-Attributes: gid10ab99,public
X-Google-Thread: 10b997,c0ddc6be4555af4a,start
X-Google-Attributes: gid10b997,public
From: "Alfredo Mora" <micdata@tin.it>
Subject: PROBLEMA PER PROGRAMMATORI VB5 E DELPHI
Date: 1998/05/30
Message-ID: <6kplsd$ntk@everest.vol.it>
X-Deja-AN: 358010473
X-Mimeole: Produced By Microsoft MimeOLE V4.71.1712.3
Organization: Telecom Italia Net
Newsgroups: alt.lang.basic,alt.lang.delphi,it.comp.delphi,it.comp.lang.visual-basic,tin.it.computer.delphi