Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have been working on some audio programs using DirectX. I have been developing them on XP and was surprised to find that the programs would not run under Win7 X64. I have the DirectX SDK June 2010 installed on both OS's. In order to isolate the problem I created this simple piece of code.

MIDL
namespace Win7AudioTest
{
    public partial class Form1 : Form
    {
        // This code compiles and runs under XP with Vis2008
        // it compiles under Win7 with Vis2008 (Build Succeeded)
        // but will not run unless the next line is commented out.

        public Audio _audio = null;

        public Form1()
        {
            InitializeComponent();
        }
    }
}


Any suggestions would be appreciated.
Posted
Comments
Yanick Salzmann 9-Apr-11 11:43am    
How does the "will not run" manifest itself? Do you get an exception? Isnt it doing anything or whats the problem?
[no name] 9-Apr-11 11:49am    
I get the window Win7AudioTest has stopped working
Yanick Salzmann 9-Apr-11 11:54am    
And what is the debugger telling if you are starting it in debug mode? And if you open the More details view in the "has stopped working"-window does it show you an exception type?
[no name] 9-Apr-11 11:59am    
I get error 2652
[no name] 9-Apr-11 12:19pm    
This is the compiler debug inf:

System.BadImageFormatException was unhandled
Message=" is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)"
Source="Win7AudioTest"
StackTrace:
at Win7AudioTest.Form1..ctor()
at Win7AudioTest.Program.Main() in G:\SourceCode\2008\Media Progs\DX9 Development\Win7AudioTest\Win7AudioTest\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

I guess you are using managed DirectX (Microsoft.DirectX namespaces). Its no longer supported by microsoft and doesnt work with x64 (neither does XNA). If you want to use managed DirectX in x64 you may think about SlimDX.
 
Share this answer
 
Yanick and Luc Pattyn

Many thanks between you folks you have solved my problem. I had never noticed the CPU setting before. I recompiled 32bit and problem was solved.

Many Thanks
 
Share this answer
 
Comments
Luc Pattyn 10-Apr-11 4:52am    
you're welcome. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900