Solved

C# + DirectX

Posted on 2004-03-22
4
330 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

805 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