Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   Managed DirectX (http://www.xtremevbtalk.com/managed-directx/)
-   -   Problem initiating DirectSound (http://www.xtremevbtalk.com/managed-directx/316142-initiating-directsound.html)

wilkewitz 05-31-2010 11:16 AM

Problem initiating DirectSound
 
Recently I have been using Mcisendstring to manage all the sounds in a game I am making, however MCI was being retarded, so I decided to switch to Directsound.

I have been following this tutorial to learn the basics about setting up Directsound:
http://gpwiki.org/index.php/VBNET:DirectSound

my problem is that when I actually initiate a device or initiate a secondary buffer, VB won't load the program to debug it. I will push play, and it will sit there and after a while it will switch out of debug mode.

I have had this same problem when trying to debug without having all of my GIF images in the directory, so it wouldn't load the form and thus my program wouldn't load.

So any suggestions? All the code I'm using should be the same... and I'm Using express 08, Windows 7, and I don't know what version of DX I'm using.

Danke!

PlausiblyDamp 05-31-2010 11:19 AM

Are there any errors thrown? Is there any debug output or diagnostics being sent to the output window?

wilkewitz 05-31-2010 11:34 AM

Quote:

Originally Posted by PlausiblyDamp (Post 1362868)
Are there any errors thrown? Is there any debug output or diagnostics being sent to the output window?

I can force an error (invalid operation exception) by using
Dim dev As Device = New Device
in the declarations instead of
Dim dev as Device

but either way I can't put
dev = new Device
in the form load

I'm guessing the problem is that some sort of DX file isn't where it should be so VB can't find it, so I'm gonna download the latest DX again.

wilkewitz 05-31-2010 01:21 PM

Also, one other thing. I just created a new project just to see if I could get Dsound working on that, and the first time I ran it, it did the same thing where the mainform didn't show, and then it backed out, but this time it gave me a message:

((Program Compatability Assistant)
Windows detected that this program did not run correctly
to try and fix the problem, Windows has applied compatibility settings to this program. Windows will use these settings the next time you run the program.
Try running the program again.)

It gave me that message for this new project, and my game I've been working on, and it didn't fix the problem for either. Also, I have seen this message before and usually it does fix problems, just not for DX.

Not sure if that helps you....

wilkewitz 05-31-2010 03:40 PM

Another update, when I added the code that prevents it from running, I tried opening the application from the bin\debug folder, and I got an error message:

(unhandled exception)
System.BadImageFormatException: is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
at Theta_3._0.Gameform.Gameformload(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

PlausiblyDamp 05-31-2010 04:19 PM

Are you running on a 64 bit system by any chance? If so set the project to target x86 and this error should be resolved.

wilkewitz 05-31-2010 05:47 PM

I actually don't know... I've always assumed that 32 bit is normal, is that right? and if I'm not running 32 bit then is there a way to switch to it if it is normal?

I will check, and then try that.

wilkewitz 05-31-2010 06:21 PM

Ok, I did that and I was able to get further into the build, (past initiating the device and buffers) however switching the target created a new problem.

Now the first arraylist that is run throws an error (null reference exception)
In the first case that this occurs, I am using a for each loop to go through a bunch of rectangles... but it will happen to any other arraylist if I mark that one out.

This did not happen before I switched the target...

PlausiblyDamp 05-31-2010 06:24 PM

Changing the target type shouldn't alter how an ArrayList works, then again from what you said it was crashing before this point anyway...

When you declare your ArrayLists are you assigning a new instance of the ArrayList class to the variable?

wilkewitz 05-31-2010 06:32 PM

....Hey, originally I would declare them like
dim platforms as arraylist

but when I added = new arraylist to the end of the first problematic one, then that arraylist was skipped and the next one threw the error. I will go through them all and see if that solves this.

One more question, what exactly does changing the target do? will it alter the way my program runs on other computers?

wilkewitz 05-31-2010 06:44 PM

Dude, I'm getting a plethora of similar problems, and I don't know how to fix all of them...

after add "= new arraylist" to all my array declarations, I now get a nullreference with my bitmaps

most of my variables start off as null, and I give them values before I use them. will this cause trouble when the target is changed to x86?

wilkewitz 05-31-2010 06:48 PM

fixed... I just had to add all my resources to the x86 debug folder...

Ok, my problem has been completely resolved, and I have gotten directsound to work.

Thank you!!!!


All times are GMT -6. The time now is 05:34 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.