Autor Beitrag
stiftmaster
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 149



BeitragVerfasst: Do 23.06.05 23:53 
Hallo Leute,

ich habe mir die Tage eine kleine DLL in Delphi 7 programmiert und binde die nun auch in meiner Applikation ein - das läuft soweit ganz gut. Ein Freund von mir programmiert zur Zeit etwas in VB6. Da er einen Teil meiner DLL gut gebrauchen könnte, wollte ich fragen, ob ich die ihm einfach schicken kann und er die dann ohne Probleme einbinden kann (wenn ich ihm die Deklarationen nenne)? Oder kann eine DLL nur von dem Programm verwendet werden, in dem es auch programmiert ist?

Danke für eure Antwort

Stefan

Moderiert von user profile iconTino: Titel geändert.
Moderiert von user profile iconTino: Topic aus Sonstiges verschoben am Fr 24.06.2005 um 09:35
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Fr 24.06.05 00:17 
klar, die dll kannst du in nahezu jeder programmiersprache verwenden.

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
stiftmaster Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 149



BeitragVerfasst: Fr 24.06.05 09:03 
na, das freut mich ja zu hören - dann ist ja mein Teil der Programmierung schon so gut wie abgeschlossen :-)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
library Project1;

function TestFunction(Value: PChar): WideString; stdcall;
var
begin
  Result := Value;
end;

exports
  TestFunction;

begin

end.


es weiß nicht rein zufällig jemand, wie man diese Funktion dann in VB6 aufrufen kann - mein Kollege hat nämlich leider noch keiner Erfahrung mit der DLL-Programmierung :-(

Stefan

Moderiert von user profile iconChristian S.: Such- durch Delphi-Tags ersetzt *g*
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Fr 24.06.05 09:14 
ausblenden Quelltext
1:
Declare Function Funktionsname Lib "DLL_DATEINAME" ( ByVal Parameter As Typ) As Typ					

dann halt noch im code mit funktionsname aufrufen.

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
nelle
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Fr 24.06.05 09:51 
Genau: Für Dein Beispiel wäre Folgendes in einer VB6 - Moduldatei zu schreiben:
ausblenden Quelltext
1:
Declare Function TestFunction Lib "Project1.DLL" (ByVal Value As String) As String					


Nelle
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 24.06.05 09:56 
In DLLs solltest Du generell auf die Nutzung von AnsiString und WideString verzichten, da diese Typen von VB nicht vollständig unterstützt werden. Nimm dazu PChar, den versteht auch VB ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
stiftmaster Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 149



BeitragVerfasst: Fr 24.06.05 19:13 
Hallo Leute,

ich habe nun in VB6 folgendes kurzes Programm zum Testen benutzt. wenn ich dann das Programm starte, stürzt ganz VB ab. Ich weiß jetzt leider nicht, ob es an meiner DLL liegt, oder ob die einfach falsch in VB6 eingebunden wird.

ausblenden Quelltext
1:
2:
3:
4:
Private Declare Function EncodeString Lib "D:\Project1.dll" (ByVal Value, Key As String) As String
Private Sub Command1_Click()
  Text1.Text = EncodeString("test", "1")
End Sub


Vielen Dank für eure Mühe

Stefan
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Sa 25.06.05 01:49 
Zitat:
Function EncodeString Lib "D:\Project1.dll" (ByVal Value, Key As String) As String


ausblenden Delphi-Quelltext
1:
function EncodeString(Value, Key: PChar): WideString; stdcall;					

ausblenden Quelltext
1:
Private Declare Function EncodeString Lib "project1.dll" (ByVal Value As String, ByVal Key As String) As String					

_________________
Ciao, Sprint.