Results 1 to 2 of 2

Thread: ChangeDisplaySettings API

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    ChangeDisplaySettings API

    I am using the ChangeDisplaySettings API and was wondering if it has the ability to change screen orientation. Meaning if there are two monitors if it is set as clone, or span. The structure for this has a member called dmPosition which according to MSDN "Windows 98/Me, Windows 2000/XP: Position of the device in a multimonitor configuration". But I don't think that is it.

    If this API doesn't have that ability, if anyone knows of another api, or some other way to set the multimonitor configuration that would be great.
    Thanks
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: ChangeDisplaySettings API

    Ok I've made it a bit farther. I am using the ChangeDisplaySettingsEX API. This api enables me to select which monitor to change the display settings on. I am having one issue with it when I try and change the position of the secondary monitor. No matter what point I use it always goes to the left of the primary screen, which is always located at 0,0. Does anyone have any idea why this is occuring? Here is a short snippet of code.
    VB Code:
    1. Private Declare Function ChangeDisplaySettingsEx Lib "user32.dll"_
    2.                 Alias "ChangeDisplaySettingsExA" (ByVal lpszDeviceName As String,_
    3.                 ByRef lpDevMode As DEVMODE, ByVal hwnd As Int32, ByVal dwflags As Int32,_
    4.                 ByVal lParam As Int32) As Int32
    5.  
    6.     Public Sub ChangeSettings(ByVal DeviceName as String)
    7.         Dim DevM as DEVMODE
    8.  
    9.         DevM.dmSize = CShort(Marshal.SizeOf(DevM))
    10.         DevM.dmFields = DM_POSITION
    11.         DevM.dmPostion = New Point(0,1024) ' if the primary monitor resolution is set to 1280 X 1024 this should put the secondary screen under the primary
    12.  
    13.         lResult = ChangeDisplaySettingsEx(DeviceName, DevM, 0&, CDS_UPDATEREGISTRY, 0&)
    14.     End Sub

    I'll take any help I can get. If you have any other ideas on how I can go about changing the displaysettings I would love to hear it.

    Thanks
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width