Author Topic: Can't load bass in to project C#  (Read 3698 times)

DJob

  • Posts: 5
Can't load bass in to project C#
« on: 27 Dec '09 - 12:19 »
Hi

I am making a DJ application in C#, but I can not go on with it because I have made the player in a User form but when i want to ad the user form into my main form it says can't find Bass.dll. I tried to add the bass.dll as a reference but then i get an error like Please make sure that the file is accessible and its an valid COM component. I have placed the dll into all kinds of folders and subfolders from my project.

Does anyone have an answer to the kind of problem?????

Job

radio42

  • Posts: 4688
Re: Can't load bass in to project C#
« Reply #1 on: 27 Dec '09 - 14:15 »
Please see the BASS.NET help file for a detailed explanation.
a) YOu don't need to reference the bass.dll directly - you just need to reference the BASS.NET.dll
b) the bass.dll needs to be placed in your executable folder (e.g. bin/Debug)

DJob

  • Posts: 5
Re: Can't load bass in to project C#
« Reply #2 on: 27 Dec '09 - 18:09 »
I did...
But because I have the players in user controls it says that

Job

radio42

  • Posts: 4688
Re: Can't load bass in to project C#
« Reply #3 on: 27 Dec '09 - 18:14 »
That sounds strange...I'm also using user controls and don't get such problems.
After what function call and when exactly do you get the error message?
Maybe some code samples might help to see what you are exactly doing...

JJS

  • Posts: 132
Re: Can't load bass in to project C#
« Reply #4 on: 28 Dec '09 - 02:52 »
I suspect he's got initialization code in his user control that is executing at design time (when he tries to add the control to a form)...  so perhaps he should also look a C#/.NET reference.








DJob

  • Posts: 5
Re: Can't load bass in to project C#
« Reply #5 on: 28 Dec '09 - 11:32 »
I just have my player in a user control and when i add the usercontrol to the mainform I get a messagebox:

Code: [Select]
Failed to create component 'player'. the error message follows:
'System.dllNotFoundException: Unable to load 'bass.dll': Can't find the libary. (Exception from HRESULT: 0x8007007E)
 at Un4seen .Bass.Bass.Bass_Init(Int32 A_0, Int32 A_1, BASSInit A_2, IntPtr A_3, IntPtr A_4)
 at Un4seen .Bass.Bass.Bass_Init(Int32 device, Int32 freq, BASSInit flags, IntPtr win)
 at DJ_app.player.player_load(Object sender, EventArgs e) in C:\Documents and Settings\Job\My Documents\Visual Studio 2008\Project\DJ_app\DJ_app\player.cs:line114
 at System.Windows.Forms.UserControl.OnLoad(EventArgs e)
 at System.Windows.Forms.Usercontrol.OnCreateControl()
 at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
 at System.Windows.Forms.Control.CreateControl()
 at System.Windows.Forms.Control.ControlCollection.Add(Control value)
 at System.Windows.Forms.Design.ParentControlDesigner.AddChildControl(Control newChild)
 at System.Windows.Forms.Design.ParentControlDesigner.AddControl(Control newChild, IDi...'

I am using Windows XP Microsoft Visual C# 2008 Version 9.0.30729.1 SP
and .net framework 3.5 SP1

radio42

  • Posts: 4688
Re: Can't load bass in to project C#
« Reply #6 on: 28 Dec '09 - 14:24 »
Yes, that sounds like a problem as JJS expained it.
Is it possible for you to move your code using BASS outside the OnLoad method?
As an alternative you might include a PATH to the bass.dll location to your environment.

However, as you are calling BASS_Init in your user control, that doesn't seem to look quite perfect, as you should only call BASS_Init once...so when you are using multiple of your user controls and all are calling BASS_Init in their OnLoad method, some of them will for sure fail with an ERROR_ALREADY.

DJob

  • Posts: 5
Re: Can't load bass in to project C#
« Reply #7 on: 28 Dec '09 - 17:52 »
I tried what you said and IT WORKED :) :D

Thanks for helping ;D

Job

noelquipit

  • Posts: 15
Re: Can't load bass in to project C#
« Reply #8 on: 25 Jul '19 - 10:39 »
How did you make this problem work?
I'm also using user control, i already removed my designer.cs and put all the code on the form body. but when i drag the control into my form, attached error appears.
Anyone can help me on this?

Ian @ un4seen

  • Administrator
  • Posts: 22829
Re: Can't load bass in to project C#
« Reply #9 on: 25 Jul '19 - 13:57 »
That looks like it was unable to find the BASS.DLL file. It should be placed alongside your app's EXE file. Alternatively, you can provide its path to the Bass.LoadMe method. Also make sure you use the right DLL for 32-bit or 64-bit.

noelquipit

  • Posts: 15
Re: Can't load bass in to project C#
« Reply #10 on: 26 Jul '19 - 02:30 »
yes i did put all library on my debug folder, also the dll that imi using is also working. Because it works when running on form. Im confuse on Bass.LoadMe where to find this?

Ian @ un4seen

  • Administrator
  • Posts: 22829
Re: Can't load bass in to project C#
« Reply #11 on: 26 Jul '19 - 15:15 »
The LoadMe method is provided by BASS.Net. Details here:

   www.bass.radio42.com/help/html/6da44ae0-fe1f-e57f-e80a-22a74889c4c8.htm