Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7028673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:26:24+00:00 2026-05-28T00:26:24+00:00

I need to integrate a DirectX9 device in a C++ Windows Form – how

  • 0

I need to integrate a DirectX9 device in a C++ Windows Form – how do I do that?

On the one hand I got my DirectX application….

HWND hWnd;
WNDCLASSEX wc;

ZeroMemory(&wc, sizeof(WNDCLASSEX));

wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.lpszClassName = "WindowClass";

RegisterClassEx(&wc);

hWnd = CreateWindowEx(NULL, "WindowClass", "Engine",
                      WS_OVERLAPPEDWINDOW, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
                      NULL, NULL, hInstance, NULL);

ShowWindow(hWnd, nCmdShow);

m_D3D = Direct3DCreate9(D3D_SDK_VERSION);

D3DPRESENT_PARAMETERS d3dpp;

ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow = hWnd;
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
d3dpp.BackBufferWidth = SCREEN_WIDTH;
d3dpp.BackBufferHeight = SCREEN_HEIGHT;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;

// creates device
m_D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &m_Device);

and on the other hand I got my Windows Form

Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false); 
Application::Run(gcnew Form1());

How do I merge this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:26:24+00:00Added an answer on May 28, 2026 at 12:26 am

    Some info from this Source : http://www.codeproject.com/KB/directx/Irrational_Thinking.aspx

    //File: DX9Form.cpp
    #include "DX9Form.h"
    
    using namespace Forms_DX9;
    using namespace globals;
    
    void DX9Form::initD3D(HWND hHandle)
    {
    
        globals::d3d = Direct3DCreate9(D3D_SDK_VERSION);
        // create the Direct3D interface
    
        D3DPRESENT_PARAMETERS d3dpp;
        // create a struct to hold various device information
    
        ZeroMemory(&d3dpp, sizeof(d3dpp)); // clear out the struct for use
    
        d3dpp.Windowed = true; // program windowed, not fullscreen
    
        d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; // discard old frames
    
        d3dpp.hDeviceWindow = hHandle;
        // set the window to be used by Direct3D
    
        // create a device class using this information
        // and information from the d3dpp stuct
        globals::d3d->CreateDevice(D3DADAPTER_DEFAULT,
                D3DDEVTYPE_HAL,
                hHandle,
                D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                &d3dpp,
                &globals::d3ddev);
    }
    
    void DX9Form::render(void)
    {
    
        // clear the window to a deep blue
        globals::d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, 
                                  D3DCOLOR_XRGB(0, 40, 100), 1.0f, 0);
        globals::d3ddev->BeginScene(); // begins the 3D scene
    
        // do 3D rendering on the back buffer here
        globals::d3ddev->EndScene(); // ends the 3D scene
        globals::d3ddev->Present(NULL, NULL, NULL, NULL);
        // displays the created frame
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application we bought that I need to integrate, and it uses
I'm going to need to integrate a Java application that I wrote with a
I have a Java application that I need to integrate our existing PHP website
In my asp.net application i need to integrate a jquery content slider with next,
I am working on an application where I need to integrate the search engine.
I have developed a window application in VS2005 using C#. I need to integrate
Need a Math Editor to integrate to my application written on C# to be
I need to integrate the Web cam to the application. I need to take
I need to Integrate open erp hr module with php website.For that I tried
In an application I am developing I need to integrate the In-app-purchase concept, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.