Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




How To Adjust Or Change Monitor Screen Resolution With Command Button Click??


hi
how to adjust or change monitor screen resolution with command button click??

thanks saracjl




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Adjust The GUI According To Screen Resolution
Is there any way out for adjusting the GUI for various display settings of tthe monitor?
Can we scale the forms according to the display resolution?
Problem is many parts of the forms is not visible while working with lower display resolution.

kindly help...

Monitor Rate, Screen Resolution. (???)
I try to change screen resolution whit this code, everything is fine, but, can you tell me, how to change monitor rate? Everytime program changes resolution, the monitor frequency changes to 60 Hz, and everything is blinking like I was in 90's again.... How to change this value? For example to 85Hz with resolution 1024x768 ???


Code:
Option Explicit

Private Const EWX_REBOOT = 2
Private Const CCDEVICENAME = 32
Private Const CCFORMNAME = 32
Private Const DM_BITSPERPEL = &H40000
Private Const DM_PELSWIDTH = &H80000
Private Const DM_PELSHEIGHT = &H100000
Private Const CDS_UPDATEREGISTRY = &H1
Private Const CDS_TEST = &H4
Private Const DISP_CHANGE_SUCCESSFUL = 0
Private Const DISP_CHANGE_RESTART = 1


Private Type typDevMODE
dmDeviceName As String * CCDEVICENAME
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * CCFORMNAME
dmUnusedPadding As Integer
dmBitsPerPel As Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type

Private Declare Function EnumDisplaySettings Lib _
"user32" Alias "EnumDisplaySettingsA" _
(ByVal lpszDeviceName As Long, ByVal iModeNum As Long, _
lptypDevMode As Any) As Boolean

Private Declare Function ChangeDisplaySettings Lib _
"user32" Alias "ChangeDisplaySettingsA" (lptypDevMode As Any, _
ByVal dwFlags As Long) As Long

Private Declare Function ExitWindowsEx Lib _
"user32" (ByVal uFlags As Long, _
ByVal dwReserved As Long) As Long

Public Function ChangeDisplayResolution(NewWidth As Long, _
NewHeight As Long) As Boolean

'Usage: ChangeDisplayResolution 800, 600

'Returns: True if succesful, false otherwise

'Comments: Problems have been reported using this code for
'resolutions higher than 1024 X 768. We recommend not using this
'snippet to go above this limit.


Dim typDM As typDevMODE
Dim lRet As Long
Dim iResp As Integer

'typDM = pointer to info about current
'display settings

lRet = EnumDisplaySettings(0, 0, typDM)
If lRet = 0 Then Exit Function

' Set the new resolution.
With typDM
.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
.dmPelsWidth = NewWidth
.dmPelsHeight = NewHeight
End With

'Do the update -- Pass update structure to
'ChangeDisplaySettings API function
lRet = ChangeDisplaySettings(typDM, CDS_UPDATEREGISTRY)
Select Case lRet
Case DISP_CHANGE_RESTART

iResp = MsgBox _
("You must restart your computer to apply these changes." & _
vbCrLf & vbCrLf & "Restart now?", _
vbYesNo + vbInformation, "Screen Resolution Changed")
If iResp = vbYes Then
ChangeDisplayResolution = True
Reboot
End If

Case DISP_CHANGE_SUCCESSFUL
ChangeDisplayResolution = True
Case Else
ChangeDisplayResolution = False
End Select

End Function

Private Sub Reboot()
Dim lRet As Long
lRet = ExitWindowsEx(EWX_REBOOT, 0)
End Sub
i was trying to add one more line in the code :


Code:
With typDM
.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
.dmPelsWidth = NewWidth
.dmPelsHeight = NewHeight
.dmdmDisplayFrequency = 85 '<this one
End With
but it's still 60 Hz after everything is done.
i don't understand, is this variable what i need?

Fixed Screen Size &amp; Monitor Resolution
Hello,
I made a form to be maximized when my monitor
tuned to 640x480 resolution.
I Want to keep that size when others using it on
other resolutions. How do i force my application not
to shrink and the controls on the form not to lose their
relative size?

thanks from advance

Change Monitor Resolution
Hi everybody.
Is there anyhow to change the monitor resolution?
Any help will be welcome
Thks

How To Change Monitor Resolution?
hai there, may i know how to change the monitor resolution by vb coding?

i tried the coding shown below but not working....

dm_displayfrequency = 75

so, any solution? thanks a lot

Change Resolution Of Form Based On Screen Resolution[REOPENED]
OK..here it is...i searched on the forums, and i tried a few things...and they dint really seem to work...so, Lemme lay out my problem.

I have a very high screen resolution: 1400x1050 pixels on my laptop..and Im designing my app on this.

My colleagye tried it out on his laptop (which had lesser resolution), and the application did not fit on his laptop...the buttons were dragging out of the screen space.

So, I want my application to automatically resize/adsjust based upon the screen resolution. I found some similar fourms, and I tried a few things suggested by developers..but, that did not really work out for me.

plz helpppp!!

How Would I Change Screen Resolution, Also See What The Current Resolution Is?
how to: see what screen resolution is
and change screen resolution ...

Change Screen Resolution
I want to change resolution of screen when an application starts(Change it to 800x600) and when user minimize an application it will restore back to original resolution, and when maximize again to 800x600.

Change Resolution On Screen
Hi!
I want to change the resolution on the screen with VB. Can this be done and how? Is it a WinApi?

Screen Resolution Change?
HI.

How do I make the Resolution and Color deep on my screen change when I klick on a Radio button and the klick a Button to accept? Ex. I have the Resolution 1024*768 32 Bit and I klick on a raio button with 800*600 16 Bit and the I accept with cloicking on a button and The Screen resolution an color deep changes to 800*600 16Bit???

Screen |Resolution Change
Can Any One help me in Changing The Screen Resolution. I would like to alter it when i click a button choosing the resolution. It is enough if anyone help me in the fuction or api which does that.

Change Screen Resolution
Is it possible to make a program that can change the wallpaper on the desktop? If so can I have the code to do so?

Thanks

Change Screen Resolution
hi,

anyone know how to change the screen resolution, says from 800 x 600 to 1024 x 748. i tried the SysInfo control, but the property WorkAreaHeight & WorkAreaWidth are read-only property. So any other control to change the resolution? or API?

Thanks

Change The Screen Resolution
Is there a way to change the screen resolution using an API?

Change Screen Resolution??
anyone please know how to change screen resolution using VB.net??

please i need this so soon

Screen Resolution Change
Any ideas how I would change the screen resolution from within a VB program?
Thanx

Change Screen Resolution
 hi,
  
i have program that change screen resolution. but when i change the resolution ,the screen refresh rate less to 65hz
please help me to solve this problem..
thanx

How-To Use DirectShow To Change Screen Resolution?
How can I use DirectShow to change the resolution on the Screen(In Fullscreen mode)?

Is There A Way To Change The Screen Resolution During Run Time?
What I'm trying to do is figure out how to change the screen resolution to 1024 X 768 during run time then once my program is done return the resolution to whatever size the screen was before..... does anyone have any ideas???

Change Screen Color Resolution...
I have a game that works in 256 Colors only. And about mine is True Color (32 bit). The problem is, I have to change my screen color resolution first if I want to play that game.
Would you tell me how to make a loader program that able to
change the resolution first into 256 Colors before run the game, and when I finished play the game, it could change the resolution into 32 bit again automatically. Can I?

Thank you.

Simple Screen Resolution Change
I am looking for a very simple way to change the screen resolution at the start of a game I am creating to 800 x 600 (not changing the color depth). I don't need res choice menus or anything like that (i'm sure most graphics card these days handle 800 x 600 fine). I just need a very simple, device independant way to change the resolution to 800 x 600, and then change the resolution back to the original, if it was different, when the program exits. And something that won't make the Start bar at the bottom disappear, as i've seen commonly happen as a side effect afterwards.

Thanks for any help :-)
Derek

What Is The Code To Change The Screen Resolution?
Hi Friends!

I have two command buttons on form to change the screen resolution:

1.cmd800x600
2.cmd1024x768

What is the code to change the screen resolution on pressing the above buttons?

Vblearner6

How Do You Change Computer Screen Resolution Please Help
Is there a way to change your computer screen resolution in vb?

Crazy Change Of Screen Resolution
Hello All,

when finally testing my program on a laptop I recordnised a crasy problem. On my NT4/ 2000 workstations it works perfectly. My program is made of two components: A main App (written in VB4) and a mapviewer (wirtten in vb6).

So, when I'm shelling the mapviewer from my main app, the screen resolution suddently changes to 640•480! When I'm shuting the mapviewer down, it rechanges to 1024•768 again. Why's that? I never wrote some code which does this!

When I'm starting the mapviewer from the explorer or from the command port with and without arguments it works without any problem.

Any suggestions?
Greetings, Matt-D

Forcing A Screen Resolution Change?
I want my app to be run in 1280x1024 resolution, just for clarity's sake... What would I need to change the screen's resolution?

**RESOLVED** Change Screen Resolution IN DOS
Hi,

Does anybody know if its possible to change your screen resolution BEFORE windows starts up? Does anybody know in what ini file windows stores it so I can change it in dos?

Thanks,
WP

How Do You Change The Screen Resolution With Code?
I know this will be an easy answer. At least I hope it will be. Hey I just thought of a question...Is it possible to change the resolution to a wierd one like 875 * 692 or something like that? Also can you change it to low resolutions like 320*200 that you only see in dos?

VBA Code To Change Screen Resolution
I need the code that changes the resolution to 1024 x 768 before my main form show event. If the res is already at 1024 x 768 then I do not need a change. Any help would greatly be appreciated!

How To Change Screen Resolution Without Flickering?
I want to run an application on 1024 X 768 resolution.For this I took the current resolution and after running the application it is restored.But while changing the resulution the screen is making some noice and flickering effect.Can any one tell a bettor method for this ?

Screen Resolution Change Works In Xp But Not On 2000
When I change the resolution in my code. The resolution changes fine but the taskbar is set about 1/4 of the way up the screen. I tested many other people code for screen resolution changes and the same thing happened. Now when I go home and do it on XP It works fine because you can't change the height of the takbar on XP. Is there a way to fix this problem for win2000? Even a way to change the height of the taskbar after the screen display is increased?

Super-AlwaysOnTop And Screen Resolution Change
Hi,

I got two questions:

I use this code to get my window on top and let it stay on top without putting focus on it:

Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, y, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOACTIVATE As Long = &H10
Private Const TOPMOST_FLAGS = SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOACTIVATE

Public Sub MakeNormal(hwnd As Long)
SetWindowPos hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS
End Sub
Public Sub MakeTopMost(hwnd As Long)
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS
End Sub

This works fine untill i open a game called 'Soldat' (or any other game tbh). then my window goes to the background , even if i run MakeTopMost(me.hwnd) every second it still stays behind the Soldat game , any idea how to get it on top?
If i press Alt+TAB around a little i do manage to get it on top.
Removing the SWP_NOACTIVATE flag doesnt work.

Second Question , related to the first.
THe game runs in 640*480 resolution , when i click my little form it goes back to 1024*768 (original) resolution and that causes the gae to minimize. How can i avoid this?

Grtz , DePhille

Changin The Screen Resolution By Pressing A Button
Hello,

I need your help. I want to make a programm that can change the screen resolution by pressing a button. [that means some buttons each for another resolution]

But I don't know how I can do this.

Could someone please post the necassary code here, please?


Snake17


_______________________________________________________

Please excuse my english grammar. I hope you understand.

Screen.width/height Incorrect After A Resolution Change
If my desktop is say, in 800x600, and *after* my application has launched, the screen resolution changes to 640x480, the screen.width variable will be 7200 instead of the expected 9600!

Also, screen.height will be 9000 instead of the expected 7200.

What appears to be happening.. is screen.width is being set to the destination screen.height, and screen.height is being set to the source resolution's height.
This can be consistently duplicated on multiple machines.

What gives? Any way to force "screen" to properly update itself? These options being off are making it impossible to bitblt to anything right of the 'screen.width' cutoff, even though the area is indeed visible.

Any help would be appreciated, pulling my hair out over this one. Thanks!

Is It Possible To Adjust Power Monitor Settings With Excel's VBA?
I have an Excel sheet that automatically queries a database every few minutes so that the latest changes are regularly updated.

To make sure that this is viewable at all times to people reviewing it, the Control Panel's Power Options is set to Never turn off; otherwise, the screen goes dark after a little while.

Unfortunately, there are occasional "updates" that cause the Power Options to revert to 45 minutes. (The mouse and keyboard are never used, so there is no activity that would otherwise prevent this.)

I realize I may very well be asking a bit much here, but I was wondering if there is any way to use VBA to change this setting for me?

Would this be a property in the Registry that I'd need to adjust with VBA? I'm not sure if it is or not. If it is, I think it'd be under HKEY_CURRENT_CONFIG/System/CurrentControlSet/Control/VIDEO - my best guess. Which one, however, is unknown. (The video settings I looked at in there don't really give me a clue.)

Any ideas on where/how this property could be changed without going into the Control Panel? Thoughts? Suggestions on where I might go to find the answer I seek?

Or is there something I could do with Excel to make the system think that, every once in a while, that there is some activity (for example, make the system think that the mouse moved a little so that it doesn't want to turn off the monitor)?

I know I'm probably just beating my head on the wall, but any ideas would be appreciated.






Edited by - MarkFrrl on 4/20/2006 12:51:53 AM

Using A Command Button To Click Other Command Buttons? Please Help
Hi
I am creating a program and I want to make it so if I click one command button VB automatically click other command buttons

i.e.
Clicking command 4 runs
command 1
command 2
command 3
in that order

Please help

Thanks

Adjust My Project For The Users Resolution?
My project is written in 1024*768. But many users do not have this resolution on their computer. How can I adjust my project after the users resolution?

How Do I Add A Wav File To A Command Button, Also Change The Color Of The Button When
I am having trouble with this. I am able to make a windows default soung by inserting the word beep, however if i want a different sound how to i define it. also i have forgotten exactly how to write the coding for changing the button color when it is selected. Any help would be greatly appreciated.

? Change The Font &amp; Button Color Of A Command Button
Hi,

I would like to change the font & button color of my command buttons, Does anyone know how I can do this?

Also I am curious as how to change the color of input boxes & menu bars?

Any help is greatly appreciated! Thanks in advance!

Donna

VB To Detect Resolution And Adjust Interface Size Accordingly
I have made several programs in Visual Basic 6

when I run these programs computers with lower resolutions, the program will not fit on the screen.

Suggestion I have gotten are to create the programs in 800x600 resolution, but I want to find a way to possibly detect the resolution and change the display size of the interface accordingly.

Thanks
Gene

'click' On Button Based On Screen Position
is there vb code where after setting the focus on a window i can then 'click' on an X/Y screen coordinate position?

Need To Change 1 To 0 On A Click Of A Button
Hi there. im making a client for a game i play which has differant worlds.
There are only two types of worlds high an low detail.
the only differance in this is this lowmen=1 is low details an lowmen=0 is high detail.

what im trying to do is on a click of a button be able to change the lowmen=1 to lowmen=0.
Basicly load the worlds in low detail but be able to change to high detail if needed.

Could some one tell me how i cud do this
all help is appreciated

Many thanks
Sheepy

Command Button Click
hi all......is there a way to enable a command button click after a form has loaded without me having to click it with the mouse.

thanks


john

Command Button Click
Hi all,

The command button has a click event.
Is it possible have a double click event for the button?

Thanks

Command Button Click
Hi,

What would the code be to say "do the same as when i click command 1"


VB Code:
If Text1.Text = "Test" Then(Simulate Command1)End If  Private Sub Command1_Click()    MsgBox "Button Clicked"End Sub

Command Button Click ?
Hi Everyone , have a nice day


VB Code:
Private Sub Command1_Click()Dim txt As StringDim strline() As StringDim word As StringDim mean As StringDim strvalues() As StringFF = FreeFileOpen App.Path & "words.txt" For Input As FF             txt = Input(LOF(FF), FF)    'Read the whole file        Close FF           strline = Split(txt, vbNewLine)  For z = 0 To 3203                    strvalues = Split((strline(z)), "|")                  word = strvalues(0)                  mean = strvalues(1)                  Label1.Caption = word                  Label2.Caption = mean    Next z          End Sub Private Sub Command4_Click()Unload Form1End Sub


The code given above is what i have done till now . words.txt is basically a file having vocabulary in which one word is on each line and its meaning is separated by "|".
now what i want to do is that i have couple of more cummand buttons on my form like "next word" , "show meaning" , which should have capability of moving to next word without meanings display ... or show meanings .. and then proceed to next word .. but i donno how should i put that feasibility here ..
like i had in my mind if i could give something like .. within z loop

if commandbutton2_click = true
then label1.caption=word
but this doesnt work ..
i hope i making myself clear enuff

Regards and waiting for responce

Command Button Right Click
I have a toolbar series which the client has now asked for additional functionality but with the lack of realestate they do not want any more buttons added to the toolbar.

I am trying to execute the click event for each button but need to capture if the person right clicks on a particular button.

I can capture the right click through the mousedown event but then I dont know which button was clicked

In the ButtonClick event I can retrieve which toolbar button but not which mouse button was clicked.

Is there some way I can combine the two

This is my existing function if that helps


VB Code:
Private Sub tbrMain_ButtonClick(ByVal Button As MSComctlLib.Button)'Pass the button key through to the CommandBar sub      Dim oList As CTKVList    Dim oPair As CTKVPair     On Error GoTo ErrorHandler            If Button.Key = "ReadyState" Then        Set oList = New CTKVList        Set oPair = New CTKVPair                'Set up the Key/Pair        With oPair            .Key = "Campaign"            .Type = CKVTypeString            If g_oCurrentCampaign.Title <> "" Then                .StringValue = CStr(g_oCurrentCampaign.Title)            Else                .StringValue = CStr(g_oCfgInfo.Queue)            End If        End With                'Add it to the List        oList.AddHead oPair                'Set the reason to the list generated        Me.TExtension1.TSetReason oList        CommandBar ("ReadyState")                Set oList = Nothing        Set oPair = Nothing    Else        CommandBar (Button.Key)    End If        ExitHandler:    Exit Sub    ErrorHandler:    RaiseError E_MODULE, "tbrMain_ButtonClick", Err.Number, Err.Description End Sub

Command Button Right Click
there's Private Sub cmdAdult_Click(Index As Integer)
is there a function to implement right click on command buttons?

thx

Command Button Click?
this is my last question, of the day. How would i click or start a Command button from another location. i want to process the Command1 button coding without actually clicking the button

something like
If Online = True Then

** Click Command Button **

End If

If I Click On A Command Button How Can I Get A New 1??
How can i get a new command button if i click on smathing

Copyright © 2005-08 www.BigResource.com, All rights reserved