Solved

C# + DirectX

Posted on 2004-03-22
4
326 Views
Last Modified: 2008-02-01
Hey
Do u know anything in DirectX

this is my code and its generating error
localDevice.SetDisplayMode(1024, 768, 16, 0, false);
localDevice.SetCooperativeLevel(owner, CooperativeLevelFlags.Fullscreen);

and it gives me error

Values do not fall within expected range

what do u think is the prob

thanks
0
Comment
Question by:Pushkar_00
4 Comments
 
LVL 4

Expert Comment

by:Jarodtweiss
ID: 10652045
Hey !
I'm just a beginner with Managed DirectX but for info :

public void SetDisplayMode(
    int width,
    int height,
    int bitPerPixel,
    int refreshRate,
    bool standardVgaMode
);

So I bet your problem comes from your 0 --> try 60 for example, standard refresh rate !
0
 

Accepted Solution

by:
RafeWoo earned 20 total points
ID: 10656452
Hi,

I think passing in 0 as the refresh rate just uses the default refresh rate of your monitor. Anyway my program works just fine passing in zero.

It could be that your graphics card does not support 1024x768 at 16 bit.

As a quick test try 640X480 at 32 bits.

Failing that try enumerating the modes that your card does support:


DisplayModesCollection modes = new DisplayModesCollection(localDevice);
           
foreach(SurfaceDescription desc in modes)
{
  //harvest the information in some way
   //relevant fields are desc.Width , desc.Height , desc.PixelFormatStructure.RgbBitCount                
}
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now