Well I posted the code that I have. I can't seem to get it to work. So what happens is that the program checks to see if a file exists so it can change the display if it exists then it loads the display from the database. Is there a way where I can read it from a database and but it in a capttion what display I want to use then it can switch. Because the code uses a combobox and I don't want to use a combobox.
Code:'****************************************************************** 'Check To See If Extended Display Will Be Used '****************************************************************** Dim IntCheckFile As Integer IntCheckFile = FileExists(App.Path & "\Data\ExtendedDisplay.ini") Select Case IntCheckFile Case -1 '(NOT USED) Case 0 '(NOT USED) Case 1 '****************************************************************** 'Show The Extended Display Message '****************************************************************** msg = "Super Trivia! detected that you have saved your extended display settings and will now try to attempt to reload those settings." MsgBox msg, vbOKOnly, "Super Trivia! - Extended Display Detected" '****************************************************************** 'Load The Monitor Settings '****************************************************************** dbPath = App.Path & "\Data\Settings.mdb" Set Mydb = DBEngine.Workspaces(0).OpenDatabase(dbPath, True, False, ";pwd=" & ENGINE.EnginePassword.Caption & "") Set Myrs = Mydb.OpenRecordset("WindowMode", dbOpenSnapshot) Myrs.MoveFirst A$ = Myrs!CustomDisplay ENGINE.TEMPDATA.Caption = A$ DefaultDisplay.Caption = TEMPDATA.Caption Myrs.Close Set Myrs = Nothing '****************************************************************** 'Make Setting Loaded Default Display '****************************************************************** Dim bFound As Boolean For i = 0 To cboMonitors.ListCount - 1 If cboMonitors.List(i) = TEMPDATA.Caption Then bFound = True Exit For End If Next i If bFound Then cboMonitors.RemoveItem i End If cboMonitors.AddItem TEMPDATA.Caption, 0 cboMonitors.TEXT = TEMPDATA.Caption cboMonitors.RemoveItem ("\\.\DISPLAY1") cboMonitors.ListIndex = 0 '****************************************************************** 'Move The Engine To The Correct Monitor '****************************************************************** Dim cMonTo As cMonitor Dim cMonFrom As cMonitor 'Set cMonTo = m_cM.Monitor(cboMonitors.ItemData(cboMonitors.ListIndex)) Set cMonTo = m_cM.Monitor(CInt(DefaultDisplay.Caption)) Set cMonFrom = m_cM.MonitorForWindow(Me.hwnd) If Not (cMonTo.hMonitor = cMonFrom.hMonitor) Then Dim lOffsetX As Long Dim lOffsetY As Long lOffsetX = ScaleX(Me.Left, vbTwips, vbPixels) - cMonFrom.Left lOffsetY = ScaleY(Me.Top, vbTwips, vbPixels) - cMonFrom.Top If (lOffsetX < 0) Then lOffsetX = 32 End If If (lOffsetY < 0) Then lOffsetY = 32 End If Me.Move Me.ScaleX(cMonTo.Left, vbPixels, vbTwips), Me.ScaleY(cMonTo.Top, vbPixels, vbTwips) End If End Select




Reply With Quote