2 posts :: Page 1 of 1
By: Likes:
  (Read 5274 times)  

I also wrote a dimming program, but it wasn't as fancy as a screen saver. It just checked system idle time until it was X, and then dimmed all the screens slowly (in stages), as a warning that your PC was about to lock.

Here is the code that I used to dim ALL screens no matter what: (couldn't get a for each to work due to a technicality)

PHP Formatted Code
    Sub PositionForm()
        Dim MinX As Int16
        Dim MaxX As Int16
        Dim MinY As Int16
        Dim MaxY As Int16
        For i = 0 To Screen.AllScreens.Count - 1
            With Screen.AllScreens(i).Bounds
                If .Location.X < MinX Then MinX = .Location.X
                If .Location.X + .Width > MaxX Then MaxX = .Location.X + .Width
                If .Location.Y < MinY Then MinY = .Location.Y
                If .Location.Y + .Height > MaxY Then MaxY = .Location.Y + .Height
            End With
        Debug.Print("Total Area:  " & MinX & ", " & MinY & " to " & MaxX & ", " & MaxY)
        Me.Left = MinX
        Me.Top = MinY
        Me.Width = MaxX - MinX
        Me.Height = MaxY - MinY
        Me.Visible = False
    End Sub

I also attached a screenshot so you could see what I meant.

Grim Hatchling
Registered: 03/01/12
Posts: 1
By: Likes:

Interesting. I took a look at the attached image. It might be because your primary screen (with the task bar) is in the middle. It's possible the code I've written assumes that the primary screen is the first or maybe the left-most screen. I'll have to revisit it. Unfortunately, I don't have more than one monitor nor a video card with more than one display output. The best I can do is connect my laptop to a monitor and get two screens.

Thanks for the code as well. I'll put this issue on the known issues list and will keep the code in mind when I am able to look at it.

Registered: 07/28/09
Posts: 16
2 posts :: Page 1 of 1