Solved

C# + DirectX

Posted on 2004-03-22
4
333 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

691 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