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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:12:01+00:00 2026-05-21T17:12:01+00:00

I am using the Microsoft.DirectX and Microsoft.DirectX.Direct3D references to do some drawing on my

  • 0

I am using the Microsoft.DirectX and Microsoft.DirectX.Direct3D references to do some drawing on my form. While I am running the program and the user presses CTRL ALT DEL in Windows XP and brings up the “Windows Security” form, when returning back to the Form, a DeviceLostException is thrown and when trying to handle this exception there seems to be no way to get it back.

I have done a little research into the matter and have tried several coding solutions.

        try
        {
             _d3ddevice.Present();                 
        }
        catch 
        {
            DeviceLost = true;
        }

        if (DeviceLost) 
        {
            AttemptRecovery();
        }

        this.Invalidate();
        ReadKeyboard();

        base.OnPaint(e);          

    }    

    private void AttemptRecovery()
    {
        try
        {
            _d3ddevice.TestCooperativeLevel();
        }
        catch (DeviceLostException)
        {
            Application.Exit();
        }
        catch (DeviceNotResetException)
        {
            try
            {
                _d3ddevice.Reset(_params);
                DeviceLost = false;

                InitGraphics();
                CameraPositioning();
                VertexDeclaration();
                IndicesDeclaration();         
            }
            catch (DeviceLostException)
            {
            }
        }
    }

When the program calls TestCooperativeLevel(), it said online if it catches the DeviceLostException again that there is no point in trying to reset the device.

What can I do to reset the device and continue drawing in my form?

  • 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-21T17:12:02+00:00Added an answer on May 21, 2026 at 5:12 pm

    2 things in 4 points :

    • You shouldn’t use Microsoft.DirectX, it’s deprecated since a long, long time. Check out SlimDX or SharpDX instead.
    • In order to re-create your device, you first have to wait until the device can be restored
    • When the device can be restored, you have to free all video-memory objects, and recreate them.
    • You call the Reset method.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Microsoft Access 2007 to move and massage some data between two
I'm using Microsoft.XMLHTTP to get some information from another server from an old ASP/VBScript
I'm using Microsoft Visual C# 2008 Express. In my main form, there's that X
Has any one Used DMO (Microsoft DirectX Media Objects) in C#? Not using DShow.
joystick.cs using System; using Microsoft.DirectX.DirectInput; namespace gameproject { /// <summary> /// Description of device.
I'm using Microsoft.DirectX.AudioVideoPlayback.Video class to play a video file and I would like to
See http://support.microsoft.com/kb/312629/EN-US/ I am using reponse.direct in my app as well and I am
Using Microsoft SQL Server's database mirroring capability, can the mirroring occur between two clusters?
When using Microsoft office automation I want to insert images into a spreadsheet. How
I am thinking about using Microsoft Unity for my Dependency Injection tool in our

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.