Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#6

AW: Delphi DLL und Aufruf in Excel VBA

  Alt 12. Jan 2018, 11:59
Zitat:
in VBA wenn ich ByRef einsetze bekomm ich direkt einen Aufruffehler (5)
JA weil ich davon ausgegangen bin das du den String von Delphi aus sendest.

Zitat:
in VBA Byval bekomm ich Hyroglyphen und dann einen Fehler (5)
ByVal ist korrekt.

Beispiel aus meine DLL..

der string wird so gesendet..
VB..
Code:
    Case BASSVISKIND_WMP
        With mInfos
            .SongTitle = MediaTitle
        End With
        BASSVIS_SetInfo mVisParam, mInfos
Code:
  Public Type BASSVIS_INFO
    SongTitle   As String    ' SongTitel ohne Pfad
    Songfile    As String    ' SongFile incl. Pfad (StreamFile)
  End Type
Delphi-Quellcode:
  PBASSVIS_INFO = ^TBASSVIS_INFO;
  TBASSVIS_INFO = record
    SongTitle : PAnsiChar; // Titel mit vorstehener TitelNr ('1. ')
    Songfile : PAnsiChar; // SongTitel incl. Pfad
  end;
Delphi-Quellcode:
function BASSVIS_SetInfo(Param: PBASSVIS_PARAM; Infos: PBASSVIS_INFO):
  BOOL; stdcall;

begin
  Result := False;
  case Param^.Kind of
    BASSVISKIND_WINAMP:
    begin
      Result := BASSWinampVisAPI.WINAMPVIS_SetChanInfo(Param^.VisHandle,
                                           Infos^.SongTitle,
                                           Infos^.Songfile);
gruss
  Mit Zitat antworten Zitat