Managed DirectX in Managed C++

I_R_Lee

Regular
Joined
Jul 18, 2002
Messages
50
Location
Sydney, Australia
I am trying to something in DX9 in Managed C++, but I have just one tiny question, here it is: What do you put in the #using <Whatever.dll>? I've tried #using <Microsoft.DirectX.dll> and that didn't work, so what does it?
 
Ok, I just got that bit, but another problem has risen:
Now that I have included (?) the DirectX dll, how do I actually use any of it's functions? When I put: using namespace Microsoft, DirectX isn't there. How do I deal with this one?
 
The basic declaration for DX is: (that what worked for me)

#include <d3dx9.h>

Thats basically it for all the basic DX operations. For more advanced things i think you need to copy some headers from the sdk to your folder.
 
I think including the header files only exposes the UNMANAGED com interfaces/functions.

to use the managed assemblies, afaik you just include them in the project, and code away.
 
#include <mscorlib.dll>
#include <System.dll>
#include <System.Drawing.dll>

just add .dll to the managed namespace(as seen above) you want to use.
 
Greetings fellow C++.NET junkies!!!


I am Morpheus and I have been searching for you all my life......

It is the question that drives you .....
#using <FreeYourMind>


How do I get Managed DirectX9 to work with VC++.NET Standard?


.......................................................................................................
Wise man once said "Simplicity will be the most difficult thing to master." -- ME (2003)
.............................................................................


##--- After Installing DirectX9 SDK ---##

Managed DirectX Framework Default Installation Location: %system%\Microsot.NET\Managed DirectX\v4.09.00.0900\

Goto Tools -> Options
Expand the Projects folder
Select VC++ Directories

Under "Show Directories For"
Select Reference Files

Create a newline and add the path to the Managed DirectX dll's.
..............................

That's All Folks!!

Don't try to bend the spoon....It is impossible!!! Rather it is your mind that bends..


..............................

Now calls to #using <microsoft.directx.dll> and other Managed DirectX dll's are valid and their respective namespace usages are 100% functional.

PLEASE BE ADVISED!!
VC++ will not provide you with class info when using scope operator :: . Just refer to Managed DirectX documentation for class info and namespace information.

Example:

The following code is only intended to test directx namespace usage by fully compliling and linking.
C#:
//usage.h

#using <mscorlib.dll>
#using <microsoft.directx.direct3D.dll>

using namespace microsoft::directx::direct3d;

namespace TestUsage
{
     public __gc class Usage
     {
     protected:
          PresentParameter __nogc* PParams;

     public:
          Usage()
          {
                PParams = new PresentParams;
           };

           ~Usage(){};
     };
}
C#:
//Source file usage.cpp

#include "usage.h"

int main()
{
     TestUsage* UTest = new TestUsage;
     return 0;
}
Hope this was helpful. If you still have problems...post a message and we will enter the Matrix so I can show you!!!

Continue the Journey and Remember to....
Follow the White Wabbit.

hehe

[edit]No need to make Size=1 for the entire post, simply use
C#:
 tags [/ cs] arround your code.[/edit][/COLOR]
 
Last edited:
A couple of things...

Ok, Thanks and kudos to Morpheous for making simple what Microsoft apaprently has to royally up.

Or maybe it's just my understanding of the IDE.. but I thought under projects, the #using directory would have done the trick, referecing the global assembly directory.

So, I am using Visual C++ .NET 2003 standard, and I am pleasently surprised that it did automatically pick up on the namespaces shortly after doing what morpheous suggested.

So hence my question now: what's the difference then between the assemblies in the global assembly cache, which have the whole direct3d managed enchilada and the .dll's?

Are the .dll's just "hooks" into the assemblies from Managed C++? Morpheus, can you shed light on the issue! thanks!

- Raist
 
Back
Top