![]() |
Brauche Hilfe bei Übersetzung VB - C - Delphi
Habe hier VB-Source die eine C-Dll aufruft und habe Probleme bei der Übersetzung.
Delphi-Quellcode:
Übersetzt habe ich es so, aber ich bekomme eine Zugriffsverletzung von der Dll:
Public Declare Function VB_GetModuleName Lib "USBRadio.dll" (ByVal sNameBuffer As String, ByRef iNameLenght As Integer) As Long
Public Function WVB_GetModuleName() As String Dim sBuffer As String * 256 Dim iBufferLen As Integer Dim lRet As Long lRet = VB_GetModuleName(sBuffer, iBufferLen) If lRet = 0 Then WVB_GetModuleName = Left(sBuffer, iBufferLen) End If
Delphi-Quellcode:
In VB funktioniert der Aufruf, habe ich getestet.
TFNVB_GetModuleName = function(var buf: string; var size: Integer): Integer; stdcall;
var iDummy: integer; size: integer; strDummy: string; begin SetLength(strDummy, 256); iDummy := VB_GetModuleName(strDummy, size); if IDummy = 0 then begin LeftStr(strDummy, size); OutputDebugString(PChar(strDummy)); end; end; Wal |
Re: Brauche Hilfe bei Übersetzung VB - C - Delphi
Hi,
schonmal mit PChar statt String probiert, und das var weg (ByVal, nicht ByRef)? Und Integer <--> Long? Weiß ja nicht wie das in VB ist, aber es könnte auch einmal int64 gemeint sein. Mfg FAlter |
Re: Brauche Hilfe bei Übersetzung VB - C - Delphi
Zitat:
das var vor buf war's und ich mach stundenlang rum. :oops: Wal |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:12 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