Almost got it, just a little more...

OK so I just about got the dx device to run but got stuck, here's my code: vc++.net

Device __gc * dxdev; // Create rendering device
PresentParameters __gc * dxpp;

dxdev = NULL;
dxpp =
new PresentParameters();
dxpp->SwapEffect = SwapEffect::Discard;
dxpp->Windowed =
true;
PresentParameters * dxapp
__gc[] = {dxpp};
dxdev =
new Device(0, DeviceType::Hardware, pb, createFlags::SoftwareVertexProcessing, dxapp);
dxdev->RenderState->ShadeMode = ShadeMode::Gouraud;

pb is a pointer to a picturebox control that I'm trying to create the device on.

I get the following errors and more:(I don't get errors if I leave out the above code)

c:\Projects\Orbital Calc\Form1.h(908): error C2039: 'GetObjectA' : is not a member of 'System::Resources::ResourceManager'
c:\Projects\Orbital Calc\Form1.h(945): error C2653: 'MessageBoxA' : is not a class or namespace name
c:\Projects\Orbital Calc\Form1.h(945): error C2660: 'System::Windows::Forms::Control::Show' : function does not take 1 arguments

The funny thing is that GetObjectA is never called, it's GetObject and MessageBoxA is actually MessageBox.

Thanks for any help,

Devin



Answer this question

Almost got it, just a little more...

  • Mark64

    Thanks, I found that if I include the following at the top of my Form1.h file it gives those errors, and if I take it out it's fine:

    namespace Microsoft
    {
       namespace DirectX
       {
          namespace PrivateImplementationDetails
          {
             #include <d3d9.h>
          }
       }
    }
    using namespace Microsoft::DirectX;
    using namespace Microsoft::DirectX::Direct3D;


  • savage1965

    The "A" suffix you're seeing is the actual implementation - the other name (GetObject and MessageBox) is just an alias.

    "A" means that it's the Ansi/Ascii implementation (narrow C-style strings)
    "W" means that it's the wide/unicode implementation.

    If you dig around in the various header files you'll probably find something similar to this:

    #ifdef UNICODE
        #define MessageBox MessageBoxW( ... )
    #else
        #define MessageBox MessageBoxA( ... )
    #endif

     


    It, within reason, allows you to write your programs without explictly stating either wide/narrow formats Smile

    I don't know the exact solution to your problem, but from experience those sorts of errors are usually down to bad project settings rather than the actual source code.

    Take a look at one of the DX-SDK examples to see what project settings they have (in particular you want to check that you're defining the same symbols and linking to the same libraries)..

    hth
    Jack

  • Almost got it, just a little more...