WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Change Screen Resolution


UPDATE: UDF's to handle Screen Resolution: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Display+Change~Screen~Resolution.txt


;Here's something I use at work... Guido wrote all the 
;good stuff--the DllCalls, etc., I just adapted them to
;my situation and wrapped them in a Callback.  This was
;a while ago, and if I were to do it over, I'd make some-
;thing that wasn't so customized to my workplace, and put
;the default standards in an .ini file.  Still, you should
;be able to dig out what you need.

IntControl(12,5,0,0,0)                                     ;Suppress OK to close messages
IntControl (33,0,0,0,0)                                    ;Allows only one selection at a time in Itemboxes
IntControl (49,1,0,0,0)                                    ;Enables Min/Max/Close Widgets
IntControl (1002,0,0,0,0)                                  ;Sets display state of WinBatch Icon
IntControl (1008,1,0,0,0)                                  ;Enables Close command

UserDll=StrCat(DirWindows(1),"USER32.DLL")
RES=3
DispProb=""
If IsDefined (Param1)
   Param1=StrSub(StrLower(Param1),1,2)
   If Param1=="/d" Then Goto Driver
   If (Param1<>"/d" && Param1<>"/q" && Param1<>"/s")
      ParmMsg=StrCat("Supported command line parameters:",@CRLF,@CRLF,"/d : Install new driver (NT only)",@CRLF)
      ParmMsg=StrCat(ParmMsg,"/q : Quiet mode--displays interface only if substandard settings are found",@CRLF)
      ParmMsg=StrCat(ParmMsg,"/s : Sets standard display options (800x600x16, 75hz), if supported")
      Message ("Invalid Parameter",ParmMsg)
      Exit
   EndIf
EndIf
If !IsDefined (Param1) Then Param1="/i"

;*******************************************************************************************************
;///////////////////////////////////// SPACER TO SEPARATE SECTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;Enumerate current and supported display settings       |
;-------------------------------------------------------- 
TDEVICEMODEA=BinaryAlloc(156)                      ;DEVMODE structure  
;Size of TDEVICEMODEA record: 156 Bytes
;Field offsets and sizes are:
offdmDeviceName       = 0   ;32
offdmSpecVersion      = 32  ;2
offdmDriverVersion    = 34  ;2
offdmSize             = 36  ;2
offdmDriverExtra      = 38  ;2
offdmFields           = 40  ;4
offdmOrientation      = 44  ;2
offdmPaperSize        = 46  ;2
offdmPaperLength      = 48  ;2
offdmPaperWidth       = 50  ;2
offdmScale            = 52  ;2
offdmCopies           = 54  ;2
offdmDefaultSource    = 56  ;2
offdmPrintQuality     = 58  ;2
offdmColor            = 60  ;2
offdmDuplex           = 62  ;2
offdmYResolution      = 64  ;2
offdmTTOption         = 66  ;2
offdmCollate          = 68  ;2
offdmFormName         = 70  ;32
offdmLogPixels        = 102 ;2
offdmBitsPerPel       = 104 ;4
offdmPelsWidth        = 108 ;4
offdmPelsHeight       = 112 ;4
offdmDisplayFlags     = 116 ;4
offdmDisplayFrequency = 120 ;4
offdmICMMethod        = 124 ;4
offdmICMIntent        = 128 ;4
offdmMediaType        = 132 ;4
offdmDitherType       = 136 ;4
offdmICCManufacturer  = 140 ;4
offdmICCModel         = 144 ;4
offdmPanningWidth     = 148 ;4
offdmPanningHeight    = 152 ;4
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;Bool EnumDisplaySettingsA (String:lpszDeviceName,Integer:iModeNum,Pointer:lpDevMode)
;   lpszDeviceName is a pointer to the target display adapter.  Null specifies default adapter.
;   iModeNum specifies whether to query the display adapter or the registry settings for the adapter.
;   lpDevMode is a pointer to a DevMode structure to store info about the specified graphics mode. 
ModeIndex=-1                                               ;Value of -1 returns current settings
Selection=""
While 1
   ReturnValue=DllCall(UserDll,long:"EnumDisplaySettingsA",lpnull,long:ModeIndex,lpbinary:TDEVICEMODEA )
   If ReturnValue==0 Then Break

;   Get info on relevant display settings   
   dmPelsWidth        = BinaryPeek4(TDEVICEMODEA,offdmPelsWidth)        ;Horizontal resolution
   dmPelsHeight       = BinaryPeek4(TDEVICEMODEA,offdmPelsHeight)       ;Vertical resolution
   dmBitsPerPel       = BinaryPeek4(TDEVICEMODEA,offdmBitsPerPel)       ;Color depth
   dmDisplayFrequency = BinaryPeek4(TDEVICEMODEA,offdmDisplayFrequency) ;Refresh Rate
   dmDisplayFlags     = BinaryPeek4(TDEVICEMODEA,offdmDisplayFlags)     ;Only used if monitor is greyscale or interlaced
    
   If ModeIndex<0                                          ;Index of -1 returns current settings
      CurRes=StrCat (dmPelsWidth,"x",dmPelsHeight)         ;Extract current resolution
      CurBPP=StrCat (dmBitsPerPel,"-bit")                  ;Extract current color depth
      CurRef=StrCat (dmDisplayFrequency,"Hz")              ;Extract current refresh rate             
      If dmPelsWidth<800 Then DispProb=StrCat (DispProb,"Resolution",@TAB)
      If dmBitsPerPel<16 Then DispProb=StrCat (DispProb,"Color depth",@TAB)
      If dmDisplayFrequency<75 Then DispProb=StrCat (DispProb,"Refresh rate")
      If ItemCount (DispProb,@TAB)>1 Then DispProb=StrReplace (DispProb,@TAB,", ")
      If DispProb==""                                      ;Everything checks out
         DispProb="None"                                   ;Make it readable
         If Param1=="/q" Then Exit                         ;If everything was up to snuff and quick check was selected, exit
      EndIf
   EndIf
   Line=StrCat(dmPelsWidth,"x",dmPelsHeight,"x",dmBitsPerPel,", ",dmDisplayFrequency,"Hz");Format for list
;Don't add modes with less that 640x480 resolution or 60Hz refresh to Mode list
   If (dmPelsWidth>639 && dmDisplayFrequency>59 && ModeIndex>=0) Then Selection=StrCat(Selection,Line,@TAB)
   ModeIndex=ModeIndex + 1                                 ;Index of 0 or greater returns supported modes
EndWhile

If Param1=="/s" 
   NewSetting="800x600x16, 75Hz"
   If ItemLocate (NewSetting,Selection,@TAB)==0
      Message ("Mode Not Supported","The selected settings are not supported by your display driver")
      Exit
   EndIf
EndIf
If Param1=="/s" Then Goto Set
;DispProb="Substandard Settings: "
;If ItemExtract (1,CurRes,"x")<800 Then DispProb=StrCat (DispProb,"Resolution   ")
;If ItemExtract (1,CurBPP,"-")<16 Then DispProb=StrCat (DispProb,"Color depth   ")
;If StrReplace (CurRef,"Hz","")<75 Then DispProb=StrCat (DispProb,"Refresh rate")
;If DispProb=="Substandard Settings: " Then DispProb="Substandard Settings: None"

;*******************************************************************************************************
;///////////////////////////////////// SPACER TO SEPARATE SECTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;User Interface                                         |      
;-------------------------------------------------------- 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;Begin Callback;;;;;;;;;;;;;;;;;;;;;;;;;;;
#DefineSubRoutine   DlgCallback (DlgName,DlgEvent,DlgCtrl,param4,param5)
If DlgEvent==0                                             ;Initialization 
   DialogProcOptions (DlgName,2,1)                         ;Watch ButtonPresses
;   DialogProcOptions (DlgName,7,1)                         ;Watch Itembox_ItemSelect
   DialogProcOptions (DlgName,13,1)                        ;Watch ItemBox_DblClick
   If WinVersion (5)<>"2-4-0" Then DialogControlState (DlgName,015,3,1)
   ;If Settings are substandard, display them in red text
   If ItemExtract (1,CurRes,"x")<800 Then DialogControlSet (DlgName,005,13,"255|0|0")
   If ItemExtract (1,CurBPP,"-")<16  Then DialogControlSet (DlgName,006,13,"255|0|0")
   If ItemExtract (1,CurRef,"H")<75  Then DialogControlSet (DlgName,007,13,"255|0|0")

   ;Disables Min/Max/Restore/Close widgets in windows
   hwnd=DllHwnd("Select Resolution")                       ;Window Title of desired window goes here
   sysmenu=DllCall(UserDll,long:"GetSystemMenu",long:hwnd,long:0)
   DllCall (UserDll,long:"RemoveMenu",long:sysmenu,long:61488,long:0)     ;Remove maximize from system menu
   OldStyle=DllCall(UserDll, long:"GetWindowLongA",long:hwnd,long:-16)
   NewStyle=OldStyle & ~65536                              ;Disable Maximize widget
   Result = DllCall(UserDll,long:"SetWindowLongA",long:hwnd,long:-16,long:NewStyle)
EndIf
If (DlgEvent==2 || DlgEvent==13)                           ;ButtonPress or ItemBox DoubleClick
   DialogProcOptions (DlgName,1000,2)                      ;Disable dialog and display WAIT cursor while processing
   If DlgCtrl==015                                         ;Install New Driver button
      If WinVersion (5)<>"2-4-0"
         Message ("Unsupported OS","Only Windows NT drivers are supported")
      EndIf
   EndIf
   If (DlgCtrl==016 || DlgCtrl==009)                       ;Continue button or double-click in ItemBox
      DialogControlState (DlgName,009,4,4)
      If DialogControlState (DlgName,009,2,0)<>1
         NewSetting=DialogControlGet (DlgName,009,6)       ;If Itembox is visible, get desired settings from it
      Else                                                 ;Otherwise get the settings from whichever radio button is dotted. 
         If DialogControlGet (DlgName,011,2)==1 Then NewSetting=DialogControlGet (DlgName,011,4) 
         If DialogControlGet (DlgName,012,2)==1 Then NewSetting=DialogControlGet (DlgName,012,4)
         If DialogControlGet (DlgName,013,2)==1 Then NewSetting=DialogControlGet (DlgName,013,4)
         If DialogControlGet (DlgName,014,2)==1 Then NewSetting=DialogControlGet (DlgName,014,4)
      EndIf
      Return (1)                                              ;Change Resolution
   EndIf
   If DlgCtrl==017                                         ;Toggle selection method
      If DialogControlGet (DlgName,017,4)=="List All &Modes"
         DialogControlSet (DlgName,017,4,"Suggested &Modes")    ;Rename button for toggle action
         DialogControlState (DlgName,011,3,1)              ;Make radio buttons invisible
         DialogControlState (DlgName,012,3,1)              ;Make radio buttons invisible
         DialogControlState (DlgName,013,3,1)              ;Make radio buttons invisible
         DialogControlState (DlgName,014,3,1)              ;Make radio buttons invisible
         DialogControlState (DlgName,010,3,1)              ;Make group box invisible
         DialogControlState (DlgName,009,4,1)              ;Make ItemBox visible
         DialogProcOptions (DlgName,1000,0)                ;Re-enable Dialog
         DialogControlState (DlgName,016,1,0)              ;Give focus to Continue button to make it default again
         DialogControlState (DlgName,009,1,0)              ;Give focus to ItemBox
         DialogControlSet (DlgName,009,6,"800x600x16, 75Hz")    ;Preselect default resolution
         Return (-2)
      EndIf
      If DialogControlGet (DlgName,017,4)=="Suggested &Modes"
         DialogControlSet (DlgName,017,4,"List All &Modes")     ;Rename button for toggle action
         DialogControlState (DlgName,009,3,1)              ;Make ItemBox invisible
         DialogControlState (DlgName,010,4,1)              ;Make group box visible
         DialogControlState (DlgName,011,4,1)              ;Make radio buttons visible
         DialogControlState (DlgName,012,4,1)              ;Make radio buttons visible
         DialogControlState (DlgName,013,4,1)              ;Make radio buttons visible
         DialogControlState (DlgName,014,4,1)              ;Make radio buttons visible
         DialogProcOptions (DlgName,1000,0)                ;Re-enable Dialog
         DialogControlState (DlgName,016,1,0)              ;Give focus to Continue button to make it default again
         DialogControlState (DlgName,012,1,0)              ;Give focus to default radio button
         Return (-2)
      EndIf
   EndIf
EndIf
Return(-2) 
#EndSubRoutine
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;End Callback;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Begin Dialog;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DispSetFormat=`WWWDLGED,6.1`
DispSetCaption=`Select Resolution`
DispSetX=-169
DispSetY=116
DispSetWidth=139
DispSetHeight=154
DispSetNumControls=017
DispSetProcedure=`DlgCallback`
DispSetFont=`DEFAULT`
DispSetTextColor=`DEFAULT`
DispSetBackground=`DEFAULT,DEFAULT`
DispSetConfig=123
DispSet001=`003,003,036,008,STATICTEXT,DEFAULT,"Resolution:",DEFAULT,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSet002=`003,013,036,008,STATICTEXT,DEFAULT,"Color Depth:",DEFAULT,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSet003=`003,023,036,008,STATICTEXT,DEFAULT,"Refresh Rate:",DEFAULT,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSet004=`003,033,051,012,STATICTEXT,DEFAULT,"Substandard settings:",DEFAULT,4,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSet005=`039,003,042,008,VARYTEXT,CurRes,"CurRes",DEFAULT,5,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSet006=`039,013,042,008,VARYTEXT,CurBPP,"Color Depth",DEFAULT,6,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSet007=`039,023,042,008,VARYTEXT,CurRef,"Refresh",DEFAULT,7,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSet008=`055,033,075,012,VARYTEXT,DispProb,"",DEFAULT,8,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSet009=`002,049,130,078,ITEMBOX,Selection,DEFAULT,DEFAULT,9,1,DEFAULT,DEFAULT,DEFAULT`
DispSet010=`003,045,130,078,GROUPBOX,DEFAULT,DEFAULT,DEFAULT,10,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSet011=`007,053,074,012,RADIOBUTTON,RES,"800x600x16, 60Hz",2,11,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSet012=`007,065,074,012,RADIOBUTTON,RES,"800x600x16, 75Hz",3,12,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSet013=`007,077,074,012,RADIOBUTTON,RES,"1024x768x16, 60Hz",4,13,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSet014=`007,089,074,012,RADIOBUTTON,RES,"1024x768x16, 75Hz",5,14,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSet015=`085,011,048,014,PUSHBUTTON,DEFAULT,"&Install New Driver",2,15,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSet016=`008,131,048,014,PUSHBUTTON,DEFAULT,"&Continue",1,16,32,DEFAULT,DEFAULT,DEFAULT`
DispSet017=`080,131,048,014,PUSHBUTTON,DEFAULT,"List All &Modes",3,17,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
DispSetButtonPushed=Dialog("DispSet",1) 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;End Dialog;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

:Set

;Parse selected settings
dmPelsWidth        = ItemExtract(1,NewSetting,"x")
dmPelsHeight       = ItemExtract(2,NewSetting,"x")
dmBitsPerPel       = ItemExtract(1,ItemExtract(3,NewSetting,"x"),",")
dmDisplayFrequency = StrReplace(ItemExtract(2,NewSetting," "),"Hz","")
dmDisplayFlags     = 0

;Poke Settings into DEVMODE structure 
BinaryPoke4 (TDEVICEMODEA,offdmBitsPerPel      ,dmBitsPerPel)      
BinaryPoke4 (TDEVICEMODEA,offdmPelsWidth       ,dmPelsWidth)       
BinaryPoke4 (TDEVICEMODEA,offdmPelsHeight      ,dmPelsHeight)      
BinaryPoke4 (TDEVICEMODEA,offdmDisplayFrequency,dmDisplayFrequency)    
BinaryPoke4 (TDEVICEMODEA,offdmDisplayFlags    ,dmDisplayFlags)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;Begin NT Fix;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Find selected buffer again (for NT)
ModeIndex = 0
Selection=""
While 1
   ReturnValue=DllCall(UserDll,long:"EnumDisplaySettingsA",lpnull,long:ModeIndex,lpbinary:TDEVICEMODEA)
   If ReturnValue==0 
      Message("Res Change","Strange error occurred")
      Exit
   EndIf
   dmPelsWidth2        = BinaryPeek4(TDEVICEMODEA,offdmPelsWidth)         ;Horizontal resolution
   dmPelsHeight2       = BinaryPeek4(TDEVICEMODEA,offdmPelsHeight)        ;Vertical resolution
   dmBitsPerPel2       = BinaryPeek4(TDEVICEMODEA,offdmBitsPerPel)        ;Color depth  
   dmDisplayFrequency2 = BinaryPeek4(TDEVICEMODEA,offdmDisplayFrequency)  ;Refresh Rate
   dmDisplayFlags2     = BinaryPeek4(TDEVICEMODEA,offdmDisplayFlags)      ;Only used if monitor is greyscale or interlaced
   If (dmBitsPerPel==dmBitsPerPel2 &&  dmPelsWidth==dmPelsWidth2  && dmPelsHeight==dmPelsHeight2 && dmDisplayFlags==dmDisplayFlags2 && dmDisplayFrequency==dmDisplayFrequency2)
      ; we found our setting...
      Break
   EndIf
   ModeIndex=ModeIndex+1
EndWhile
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;End NT Fix;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Set the field mask to determine fields to use for setting the display mode
DM_BITSPERPEL       = 262144  ; 0x40000
DM_PELSWIDTH        = 524288  ; 0x80000
DM_PELSHEIGHT       = 1048576 ; 0x100000
DM_DISPLAYFLAGS     = 2097152 ; 0x200000
DM_DISPLAYFREQUENCY = 4194304 ; 0x400000
dmFields = (DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFLAGS | DM_DISPLAYFREQUENCY) ; 0x7C0000 = 8126464 decimal
BinaryPoke4 (TDEVICEMODEA,offdmFields,dmFields)

CDS_DYNAMICONLY    = 0                                     ; Change current session only
CDS_UPDATEREGISTRY = 1                                     ; Change and update registry
CDS_TEST           = 2                                     ; Test only
ChangeMode         = CDS_UPDATEREGISTRY
ReturnValue        = DllCall(UserDll,long:"ChangeDisplaySettingsA",lpbinary:TDEVICEMODEA,long:ChangeMode )

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_FAILED    = -1                                 ;The display driver failed the specified graphics mode.
DISP_CHANGE_BADMODE   = -2                                 ;The graphics mode is not supported.
DISP_CHANGE_NOTUPDATED= -3                                 ;Unable to write settings to the registry.
DISP_CHANGE_BADFLAGS  = -4                                 ;An invalid set of flags was passed in.
DISP_CHANGE_BADPARAM  = -5                                 ;Bad parameters

Switch ReturnValue
   Case 1
      Line="The computer must be restarted in order for the graphics mode to work."
      Break
   Case 0
      Line="The settings change was successful."
      Break
   Case -1
      Line="The display driver failed the specified graphics mode."
      Break
   Case -2
      Line="The graphics mode is not supported."
      Break
   Case -3
      Line="Unable to write settings to the registry."
      Break
   Case -4
      Line="An invalid set of flags was passed in."
      Break
   Case -5
      Line="Bad parameters"
      Break
   Case ReturnValue
      Line="Unknown return code %ReturnValue%"
      Break
EndSwitch

If ReturnValue==1
   If ChangeMode!=CDS_UPDATEREGISTRY
      Line=StrCat (Line,@CRLF,"Because the Update Registry option was not in effect, no changes will be made")
      Message("Resolution Change",Line)
      Exit
   Else
      Pause ("Reboot machine",Line)
      IntControl (67,0,0,0,0)
   EndIf
Else
   Display (3,"Resolution Change",Line)
EndIf

Exit


:Driver
;Define list of PC300gl models
PC300gl="6263|6265|6267|6268|6272|6275|6277|6278|6282|6285|6288|6338|6563|6564|6574|6593"
PC300gl=StrReplace (PC300gl,"|",@TAB)
;Define list of PC300pl models
PC300pl="6565|6566|6584|6594|6595|6862|6872|6892"
PC300pl=StrReplace (PC300pl,"|",@TAB)
;Define list of NetVista models
NetVista="All NetVistas"
;Define list of Optiplex models
Optiplex="GX110" 

#DefineSubRoutine dlgVidCallback (DlgVidName,DlgVidEvent,DlgVidCtrl,Res4,Res5)
If DlgVidEvent==0                                          ;Initialization 
   DialogProcOptions (DlgVidName,2,1)                      ;Watch ButtonPresses
   DialogProcOptions (DlgVidName,3,1)                      ;Watch RadioButton_Select
   DialogProcOptions (DlgVidName,13,1)                     ;Watch ItemBox_DblClick
   DialogControlSet (DlgVidName,008,5,PC300gl)             ;Populate ItemBox with 300gl's by default
   DialogControlSet (DlgVidName,008,6,"6275")              ;Preselect 6275 as default
   ;Disables Min/Max/Restore/Close widgets in windows
   hwnd=DllHwnd("Install New Video Driver")                ;Window Title of desired window goes here
   sysmenu=DllCall(UserDll,long:"GetSystemMenu",long:hwnd,long:0)
   DllCall (UserDll,long:"RemoveMenu",long:sysmenu,long:61488,long:0)     ;Remove maximize from system menu
   OldStyle=DllCall(UserDll, long:"GetWindowLongA",long:hwnd,long:-16)
   NewStyle=OldStyle & ~65536                              ;Disable Maximize widget
   Result = DllCall(UserDll,long:"SetWindowLongA",long:hwnd,long:-16,long:NewStyle)
EndIf
If (DlgVidEvent==2 || DlgVidEvent==13)                     ;ButtonPress or ItemBox DoubleClick
   DialogProcOptions (DlgVidName,1000,2)                   ;Disable dialog and display WAIT cursor while processing
   If (DlgVidCtrl==008 || DlgVidCtrl==009)                 ;OK button or Type list                     
      Exit
   EndIf
   If DlgVidCtrl==010                                      ;Cancel
      Exit
   EndIf
EndIf
If DlgVidEvent==3                                          ;RadioButton_Click
   If DlgVidCtrl==002                                      ;IBM Models 
      DialogControlSet (DlgVidName,005,4,"PC 300GL")       ;Change top RadioButton from Optiplex to 300gl 
      DialogControlState (DlgVidName,006,4,1)              ;Make 300pl RadioButton visible again
      DialogControlState (DlgVidName,007,4,1)              ;Make NetVista RadioButton visible again
   EndIf
   If DlgVidCtrl==003                                      ;Dell Models
      DialogControlSet (DlgVidName,005,4,"Optiplex")       ;Change top RadioButton from 300gl to Optiplex
      DialogControlState (DlgVidName,005,1,0)              ;Select Optiplex line as default
      DialogControlState (DlgVidName,006,3,1)              ;Make 300pl RadioButton invisible
      DialogControlState (DlgVidName,007,3,1)              ;Make NetVista RadioButton invisible
   EndIf
;-----Determine what should be in ItemBox every time a RadioButton is clicked-----
   If DialogControlGet (DlgVidName,005,2)
      If DialogControlGet (DlgVidName,005,4)=="Optiplex" Then DialogControlSet (DlgVidName,008,5,Optiplex)
      If DialogControlGet (DlgVidName,005,4)=="PC 300GL" Then DialogControlSet (DlgVidName,008,5,PC300gl)
   EndIf
   If DialogControlGet (DlgVidName,006,2) Then DialogControlSet (DlgVidName,008,5,PC300pl)
   If DialogControlGet (DlgVidName,007,2) Then DialogControlSet (DlgVidName,008,5,NetVista)
EndIf
Return (-2)
#EndSubRoutine

VidDriverFormat=`WWWDLGED,6.1`
VidDriverCaption=`Install New Video Driver`
VidDriverX=-143
VidDriverY=091
VidDriverWidth=118
VidDriverHeight=0100
VidDriverNumControls=010
VidDriverProcedure=`dlgVidCallback`
VidDriverFont=`DEFAULT`
VidDriverTextColor=`DEFAULT`
VidDriverBackground=`DEFAULT,DEFAULT`
VidDriverConfig=123
VidDriver001=`002,000,054,031,GROUPBOX,DEFAULT,DEFAULT,DEFAULT,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
VidDriver002=`006,007,046,010,RADIOBUTTON,Make,"IBM models",1,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
VidDriver003=`006,017,046,010,RADIOBUTTON,Make,"Dell models",2,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
VidDriver004=`002,031,054,045,GROUPBOX,DEFAULT,DEFAULT,DEFAULT,4,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
VidDriver005=`006,039,048,008,RADIOBUTTON,Line,"PC 300GL",3,5,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
VidDriver006=`006,049,048,008,RADIOBUTTON,Line,"PC 300PL",4,6,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
VidDriver007=`006,059,048,008,RADIOBUTTON,Line,"NetVista",5,7,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
VidDriver008=`058,002,056,075,ITEMBOX,Model,DEFAULT,DEFAULT,8,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
VidDriver009=`010,081,036,012,PUSHBUTTON,DEFAULT,"OK",1,9,32,DEFAULT,DEFAULT,DEFAULT`
VidDriver010=`068,081,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,10,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
VidDriverButtonPushed=Dialog("VidDriver",1)

Exit
BoxesUp ("300,400,700,600",@NORMAL) 
BoxColor (1,"195,195,195",0)                                       
BoxDrawRect(1,"0,0,1000,1000",2)                                   
BoxDrawText(1,"0,0,1000,1000", "   Don't touch anything until I'm done   ",@TRUE,21)
BoxCaption (1,"Installing video driver...")
IntControl (54,"Installing video driver...",1,0,0)   

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If (MODEL=="6263" || MODEL=="6265" || MODEL=="6275" || MODEL=="6285") Then Driver=("E18Z29US")
If (MODEL=="6862" || MODEL=="6872" || MODEL=="6892") Then Driver=("E18Z29US")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If (MODEL=="6267" || MODEL=="6277" || MODEL=="6287") Then Driver=("E18Z28US")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If (MODEL=="6268" || MODEL=="6278" || MODEL=="6288" || MODEL=="6338") Then Driver=("E48Z27US")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If (MODEL=="6272" || MODEL=="6282" || MODEL=="6284") Then Driver="ZV4T06A" ;(Cirrus)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If (MODEL=="6563" || MODEL=="6564" || MODEL=="6565" || MODEL=="6566") Then Driver=("E58Z18US")
If (MODEL=="6574" || MODEL=="6593" || MODEL=="" || MODEL=="") Then Driver=("E58Z18US")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If (MODEL=="6584" || MODEL=="6594" || MODEL=="6595") Then Driver=("E58Z15US")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If (MODEL=="NETVISTA" || MODEL=="GX110") Then Driver=("E48Z27US")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

If Driver<>"" Then RunWait (StrCat(Toolbox,"\DESKTOP\",DRIVER,".EXE","")
Exit

Article ID:   W16180
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38