Advertisement

Dialog Box Controls Question

Started by December 28, 2000 05:51 PM
3 comments, last by Pho 23 years, 10 months ago
Hello all ! I am modifing NeHe OGL framework ( Lesson 1 ). Adding nice little dialog box to choose: resolution & color depth ( radio buttons ), fullscreen & FPS Counter ( check boxes ), window title ( edit box ). Problem: enabling / disabling individual controls ( radio buttons ) at run - time. Want to prevent user choosing a resolution higher then her / his Desktop setting. Is there a function to enable / disable ( gray out ) these controls ? It is really easy under MFC, but Win32 App is giving me nightmares. Thanx in advance to all reading this.
I think the function you''re looking for is

BOOL EnableWindow(
HWND hWnd, // handle to window
BOOL bEnable // flag for enabling or disabling input
);



hope that helped

Nik
Advertisement
If you are wanting to find what the current resolution in windows is, not the maximum for the video card, you can use:
  int FullScreenX=GetSystemMetrics(SM_CXFULLSCREEN);int FullScreenY=GetSystemMetrics(SM_CYFULLSCREEN);  


Hope this helps,

Nyko
The best way would be to seek all legal resolutions for the computer (legal means : That can be used, like 640*480, not 642*438, 1600*1200 would be considered as legal if the computer is able to display it)
(you can find me on IRC : #opengl on undernet)
That''s it !

I just use:

EnableWindow( GetDlgItem( hDlg, IDR_CONTROL ), FALSE );

and the control is disabled.

Thanx for help LeMatsch.


Nyko, I check for current Desktop resolution this way:

hDC = GetDC( NULL );
Width = GetDeviceCaps( hDC, HORZRES );
Height = GetDeviceCaps( hDC, VERTRES );
ColorDepth = GetDeviceCaps( hDC, BITSPIXEL );

I''ll try your solution. Perhaps I can get rid of that first line of code.


SKSlayer, it is a nice idea. Is it possible ?

This topic is closed to new replies.

Advertisement