Page 2 of 2

Posted: Fri Jan 27, 2006 9:40 am
by netmaestro
dtw=GetSystemMetrics_(#SM_CXSCREEN)
dth=GetSystemMetrics_(#SM_CYSCREEN)
I got that right off the FAQ sticky at the top of this forum. Perhaps it could use an update?

Posted: Fri Jan 27, 2006 11:27 am
by PB
> I got that right off the FAQ sticky for this forum. Perhaps it could use an update?

Now deleted from the FAQ. :)

Posted: Thu Aug 31, 2006 6:35 am
by J. Baker
I can't seem to get it to change the frequency?
Droopy wrote:Code from DarkDragon & Gillou

Code: Select all

#DISP_CHANGE_SUCCESSFUL = 0   ; The settings change was successful.
#DISP_CHANGE_RESTART = 1      ; The computer must be restarted in order for the graphics mode to work.
#DISP_CHANGE_BADFLAGS = -4    ; An invalid set of flags was passed in.
#DISP_CHANGE_FAILED = -1      ; The display driver failed the specified graphics mode.
#DISP_CHANGE_BADMODE = -2     ; The graphics mode is not supported.
#DISP_CHANGE_NOTUPDATED = -3  ; Windows NT only: Unable to write settings to the registry.

ProcedureDLL ChangeDisplaySettings(width,height,Depth,Freq,Permanent)
  dmScreenSettings.DEVMODE 
  dmScreenSettings\dmSize = SizeOf(dmScreenSettings) 
  dmScreenSettings\dmPelsWidth = width
  dmScreenSettings\dmPelsHeight = height
  dmScreenSettings\dmBitsPerPel = Depth
  dmScreenSettings\dmDisplayFrequency=Freq
  dmScreenSettings\dmFields = 262144 | 524288 | 1048576 
  
  If Permanent
    retour=ChangeDisplaySettings_(@dmScreenSettings, 1) 
  Else
    retour=ChangeDisplaySettings_(@dmScreenSettings, 4) 
  EndIf
  
  ProcedureReturn retour
EndProcedure

;/ Test
ChangeDisplaySettings(1024,768,16,70,0)
MessageRequester("Change Display Settings","OK to Restore")

Posted: Thu Aug 31, 2006 6:52 am
by netmaestro
Change the line:

Code: Select all

dmScreenSettings\dmFields = 262144 | 524288 | 1048576 
to:

Code: Select all

dmScreenSettings\dmFields = 262144 | 524288 | 1048576 | 4194304
to include the displayfrequency in the selected fields. Right now all you've got in there is width, height and depth. If you don't specify a field, it won't be modified.

Posted: Thu Aug 31, 2006 7:03 am
by J. Baker
netmaestro wrote:Change the line:

Code: Select all

dmScreenSettings\dmFields = 262144 | 524288 | 1048576 
to:

Code: Select all

dmScreenSettings\dmFields = 262144 | 524288 | 1048576 | 4194304
to include the displayfrequency in the selected fields. Right now all you've got in there is width, height and depth. If you don't specify a field, it won't be modified.
DOH! :oops:

Thanks! :wink:

Posted: Thu Aug 31, 2006 1:06 pm
by netmaestro
It's possible the code you're using was written for a version of PureBasic that didn't have these devmode constants defined. PureBasic 4.0 has them, so it really would be more readable (and easier to notice something missing!) if you write it this way:

Code: Select all

dmScreenSettings\dmFields = #DM_PELSWIDTH | #DM_PELSHEIGHT | #DM_BITSPERPEL | #DM_DISPLAYFREQUENCY

Posted: Fri Sep 15, 2006 8:08 am
by TheCorporation
Is it possible to let the change made to resolution when quitting Pure Basic ?

(Because this source code (or PB ?) get back to default settings when ending).

Posted: Fri Sep 15, 2006 8:58 am
by J. Baker
TheCorporation wrote:Is it possible to let the change made to resolution when quitting Pure Basic ?

(Because this source code (or PB ?) get back to default settings when ending).
Yes by changing the second value of "ChangeDisplaySettings". Just look it up in windows api to get the correct value.