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 6868961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:29:57+00:00 2026-05-27T03:29:57+00:00

I created a really simple DirectX program to capture the screen. It works well

  • 0

I created a really simple DirectX program to capture the screen. It works well on my machine, but fails on another machine in the following line with a segmentation fault (SIGSEV):

g_pd3dDevice->GetFrontBufferData(0, g_pSurface);

The following function is used to initialize DirectX:

HRESULT InitD3D(HWND hWnd)
{
D3DDISPLAYMODE  ddm;
D3DPRESENT_PARAMETERS   d3dpp;

if((g_pD3D=Direct3DCreate9(D3D_SDK_VERSION))==NULL)
{
    ErrorMessage("Unable to Create Direct3D ");
    return E_FAIL;
}

if(FAILED(g_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&ddm)))
{
    ErrorMessage("Unable to Get Adapter Display Mode");
    return E_FAIL;
}

ZeroMemory(&d3dpp,sizeof(D3DPRESENT_PARAMETERS));

d3dpp.Windowed=WINDOW_MODE;
d3dpp.Flags=D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
d3dpp.BackBufferFormat=ddm.Format;
d3dpp.BackBufferHeight=nDisplayHeight=gScreenRect.bottom =ddm.Height;
d3dpp.BackBufferWidth=nDisplayWidth=gScreenRect.right =ddm.Width;
d3dpp.MultiSampleType=D3DMULTISAMPLE_NONE;
d3dpp.SwapEffect=D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow=hWnd;
d3dpp.PresentationInterval=D3DPRESENT_INTERVAL_DEFAULT;
d3dpp.FullScreen_RefreshRateInHz=D3DPRESENT_RATE_DEFAULT;

if(FAILED(g_pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_REF,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING ,&d3dpp,&g_pd3dDevice)))
{
    ErrorMessage("Unable to Create Device");
    return E_FAIL;
}

if(FAILED(g_pd3dDevice->CreateOffscreenPlainSurface(ddm.Width, ddm.Height, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &g_pSurface, NULL)))
{
    ErrorMessage("Unable to Create Surface");
    return E_FAIL;
}

return S_OK;
}

Any ideas why this would throw a segmentation fault?

  • 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-27T03:29:57+00:00Added an answer on May 27, 2026 at 3:29 am

    Solution: The DirectX driver was not correctly installed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well this is really simple but I have no clue.. I have a htaccess
I created a really simple Java program that creates a java.net.ServerSocket on an open
I created this really simple function following the documentary of WordPress and as I
I have a really simple site that I created. I am trying to test
This is probably really simple. But I guess I'm too new to WSGI and
Okay, I'm probably missing something really simple here, but I've been at this for
I've got a really simple rails question here but I can't seem to find
I'm sure this is a really simple question. The following code shows what I'm
I've created a really simple bash script that runs a few commands. one of
This may be really simple. I have created a class with a list public

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.