AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

Standard DLL in VB geschrieben

Ein Thema von EWeiss · begonnen am 21. Sep 2008 · letzter Beitrag vom 22. Sep 2008
 
EWeiss
(Gast)

n/a Beiträge
 
#1

Standard DLL in VB geschrieben

  Alt 21. Sep 2008, 20:20
Für die ganz schlauen hier die meinen das es nicht geht.. @Elvis
Lebst vielleicht doch hinterm Mond ? hihiiihi nur Spass

"DLL"
Delphi-Quellcode:
Function DLLMain(ByVal A As Long, ByVal B As Long, ByVal c As Long) As Long
    DLLMain = 1
End Function

Sub Main()
    //This is a dummy, so the IDE doesn't complain
    //there is no Sub Main.
End Sub

//add more functions here, ie.
Function addition(ByVal A As Double, ByVal B As Double) As Double
  addition = A + B
End Function

Function subtraction(ByVal A As Double, ByVal B As Double) As Double
  subtraction = A - B
End Function

Function showmsg() As String
Dim sInput As Long
Dim intMin As Integer
Dim intSec As Integer
Dim TimeString As String

    sInput = InputBox("Bitte Zeit in MilliSekunden eingeben", "Result Zeit in Sekunden")
    If sInput > 0 Then
        intMin = sInput \ 60
        intSec = Int(sInput - intMin * 60)
        TimeString = Format$(intMin, "00") & ":" & Format$(intSec, "00")
    End If

    showmsg = TimeString
  
End Function
"Anwendung"
Delphi-Quellcode:
Private Declare Function subtraction Lib "TestDLL.DLL" (ByVal A As Double, ByVal B As Double) As Double
Private Declare Function addition Lib "TestDLL.DLL" (ByVal A As Double, ByVal B As Double) As Double
Private Declare Function showmsg Lib "TestDLL.DLL" () As Long

// Windows API Declaration
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" ( _
    ByVal lpString As Long _
) As Long

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
    ByRef Destination As Any, _
    ByRef Source As Any, _
    ByVal Length As Long _
)

Private Sub btnTime_Click()
    lblTime.Caption = VBStrFromAnsiPtr(showmsg())
End Sub

Private Sub cmdExit_Click()
End
End Sub

Private Sub Form_Load()
lblResult(0) = "9.87 + 2.99 = " & CStr(addition(9.87, 2.99))
lblResult(1) = "10 - 8.43 = " & CStr(subtraction(10, 8.43))
lblResult(2) = "9999 + 1543 = " & CStr(addition(9999, 1543))
End Sub

Private Function VBStrFromAnsiPtr(ByVal lpStr As Long) As String
Dim bStr() As Byte
Dim cChars As Long
    On Error Resume Next
    // Get the number of characters in the buffer
    cChars = lstrlen(lpStr)
    // Resize the byte array
    ReDim bStr(0 To cChars - 1) As Byte
    // Grab the ANSI buffer
    Call CopyMemory(bStr(0), ByVal lpStr, cChars)
    // Now convert to a VB Unicode string
    VBStrFromAnsiPtr = StrConv(bStr, vbUnicode)
End Function
Test im Anhang

Edit:
hab noch eine Function angehängt
Angehängte Grafiken
Dateityp: jpg dependency_156.jpg (82,7 KB, 17x aufgerufen)
Angehängte Dateien
Dateityp: rar compiled_112.rar (6,6 KB, 12x aufgerufen)
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:04 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz