![]() |
Delphi nach C#
Delphi-Quellcode:
PBASSVIS_PLUGINS = ^TBASSVIS_PLUGINS;
TBASSVIS_PLUGINS = record PluginHandle : HVIS; // Plugin Handle PluginPath : string; // Plugin Name mit Pfad PluginName : string; // Plugin Name ohne Pfad ModuleCount : integer; // Module Preset Count ModuleName : array of string; // Module Preset Name end; Mein Anfang!
Code:
[Serializable, StructLayout(LayoutKind.Sequential)]
public sealed class BASSVIS_PLUGINS { public int PluginHandle; [MarshalAs(UnmanagedType.LPStr)] public string PluginPath = string.Empty; [MarshalAs(UnmanagedType.LPStr)] public string PluginName = string.Empty; public int ModuleCount; [MarshalAs(UnmanagedType.LPStr)] public string[,] ModuleName; public BASSVIS_PLUGINS(BASSVIS_PLUGINS[,] Plugins) { } }
Delphi-Quellcode:
function BASSVIS_GetPlugins(
Kind: TBASSVIS_KIND_T; PluginPath: PAnsiChar; Searchflags: DWORD ): TPlugins; stdcall; external dllfile;
Code:
//BASSVIS_GetPlugins
[return: MarshalAs(UnmanagedType.Struct)] [DllImport("bass_vis.dll", EntryPoint = "BASSVIS_GetPlugins", CharSet = CharSet.Auto)] private static extern BASSVIS_PLUGINS[,] BASSVIS_GetPlugins(BASSVISKind kind, [In, MarshalAs(UnmanagedType.LPStr)] string PluginPath, BASSVISFindFlags BASSVIS_FIND_DEFAULT);
Delphi-Quellcode:
TPlugins = array of TBASSVIS_PLUGINS
Code:
EDIT:
public BASSVIS_PLUGINS(BASSVIS_PLUGINS[,] Plugins)
Bin mir aber nicht sicher ob das alles seine richtigkeit hat. gruss |
AW: Delphi nach C#
Gibt es einen speziellen Grund, dass du nicht einfach Bass .NET benutzt?
Laut Beschreibung sollten doch alle Addons dabei sein. |
AW: Delphi nach C#
Zitat:
Und Bass.NET diese nicht unterstützt da ich meinen eigenen NET.Wrapper habe. Das dauert zwar solche sachen wie hier zu Konvertieren damit bin ich aber unabhängig. Sorry deine Frage hilft mir aber nun wirklich nicht weiter. ;) gruss |
AW: Delphi nach C#
Hätte ja sein können, dass du das nicht kennst. ;-)
Gut, also was mir auf den ersten Blick auffällt ist, dass da das stdcall fehlt. In DllImport muss noch stehen:
Code:
CallingConvention=CallingConvention.StdCall
|
AW: Delphi nach C#
Zitat:
Bekomme jetzt diese Meldung nach meiner Änderungen. Zitat:
Code:
private BASSVIS_PLUGINS[,] Plugins;
Code:
Meine Änderung!
Plugins = BassVis.BASSVIS_GetPlugins((BASSVISKind)cbVisType.SelectedIndex, PluginDir, true);
if (Plugins != null) { foreach (BASSVIS_PLUGINS p in Plugins) { string name = Path.GetFileName(p.PluginPath); string path = Path.GetDirectoryName(p.PluginPath); lstPlugins.Items.Add(name); pluginPathList.Add(path); } }
Code:
ObjectBrowser..
//BASSVIS_GetPlugins
public static BASSVIS_PLUGINS[,] BASSVIS_GetPlugins(BASSVISKind kind, string pluginPath, bool recursive) { BASSVIS_PLUGINS[,] Plugins = BASSVIS_GetPlugins(kind, pluginPath, recursive ? BASSVISFindFlags.BASSVIS_FIND_RECURSIVE : BASSVISFindFlags.BASSVIS_FIND_DEFAULT); return Plugins; } [return: MarshalAs(UnmanagedType.LPArray)] [DllImport("bass_vis.dll", EntryPoint = "BASSVIS_GetPlugins", CharSet = CharSet.Auto)] private static extern BASSVIS_PLUGINS[,] BASSVIS_GetPlugins(BASSVISKind A_0, [In, MarshalAs(UnmanagedType.LPStr)] string A_1, BASSVISFindFlags A_2);
Code:
PS:
public static BassVis_Api.BASSVIS_PLUGINS[,] BASSVIS_GetPlugins(BassVis_Api.BASSVISKind kind, string pluginPath, bool recursive)
Member of BassVis_Api.BassVis Hat leider nichts gebracht gleicher Fehler wie oben. Hätte mich auch gewundert da ich in allen meinen Funktionen das stdcall nicht addiert habe. Und diese Funktionieren. (Aber ein versuch konnte ja nicht schaden :) ) Neuer versuch..
Code:
Jetzt hat er nach dem Einsprungspunkt in der DLL gefragt. DLL ersetzt nächster Fehler.
[return: MarshalAs(UnmanagedType.SafeArray)]
Zitat:
gruss |
AW: Delphi nach C#
Soweit habe ich es schon mal..
Code:
Aber immer noch einen Fehler.
#region Winamp
if (index == Convert.ToInt32(BASSVISKind.BASSVISKIND_WINAMP)) { Plugins = BassVis.BASSVIS_GetPlugins((BASSVISKind)cbVisType.SelectedIndex, PluginDir, true); if (Plugins != null) { foreach (BASSVIS_PLUGINS p in Plugins) { string name = Path.GetFileName(p.PluginPath); string path = Path.GetDirectoryName(p.PluginPath); lstPlugins.Items.Add(name); pluginPathList.Add(path); } lstPlugins.SelectedIndex = 0; mVisParam.VisHandle = Plugins[lstPlugins.SelectedIndex].PluginHandle; int NumModule = Plugins[lstPlugins.SelectedIndex].ModuleCount; string Pluginname = Plugins[lstPlugins.SelectedIndex].PluginName; if (!(NumModule > 0)) { return; } Descript.Text = Pluginname; for (int IntI = 0; IntI <= (NumModule - 1); IntI++) { VisModules.Items.Add(Plugins[lstPlugins.SelectedIndex].ModuleName); } if (NumModule > 0) { VisModules.SelectedIndex = 0; } if (Stream != 0 && NumModule == 1) { cmdStartVis_Click(null, null); } } } #endregion Winamp
Code:
Plugins = BassVis.BASSVIS_GetPlugins((BASSVISKind)cbVisType.SelectedIndex, PluginDir, true);
Zitat:
Hatte ein 2Dimensionales Array [,] das war schon mal falsch. Was soll da falsch sein das die Klasse nicht vererbt wird?
Code:
An der Überladenen Function kann es eigentlich nicht liegen.
//BASSVIS_GetPlugins
public static BASSVIS_PLUGINS[] BASSVIS_GetPlugins(BASSVISKind kind, string pluginPath, bool recursive) { BASSVIS_PLUGINS[] Plugins = BASSVIS_GetPlugins(kind, pluginPath, recursive ? BASSVIS_FINDFLAGS.BASSVIS_FIND_RECURSIVE : BASSVIS_FINDFLAGS.BASSVIS_FIND_DEFAULT); if (Plugins != null) { return Plugins; } return null; } [return: MarshalAs(UnmanagedType.SafeArray)] [DllImport("bass_vis.dll", EntryPoint = "BASSVIS_GetPlugins", CharSet = CharSet.Auto)] private static extern BASSVIS_PLUGINS[] BASSVIS_GetPlugins(BASSVISKind kind, [In, MarshalAs(UnmanagedType.LPStr)] string pluginPath, BASSVIS_FINDFLAGS recursive); Hmm.... gruss |
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:45 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