Bah! Had some code missing as I had several methods applied in the temp project. Here is the fully working code.
Place in a standard module and change the window title to what ever site you want.
VB Code:
Option Explicit Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Type POINTAPI x As Long y As Long End Type Private Type WINDOWPLACEMENT Length As Long flags As Long showCmd As Long ptMinPosition As POINTAPI ptMaxPosition As POINTAPI rcNormalPosition As RECT End Type Private Declare Function SetWindowPlacement Lib "user32.dll" ( _ ByVal hwnd As Long, _ ByRef lpwndpl As WINDOWPLACEMENT) As Long Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _ ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Declare Function SetActiveWindow Lib "user32.dll" ( _ ByVal hwnd As Long) As Long Private Const SW_SHOWNORMAL As Long = 1 Private Const SW_SHOWMINIMIZED As Long = 2 Private Const SW_SHOWMAXIMIZED As Long = 3 Private Sub Main() On Error GoTo MyError Dim lRet As Long Dim lRet2 As Long Dim wPlace As WINDOWPLACEMENT Dim rRect As RECT Shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE", vbNormalFocus Do While lRet = 0 lRet = FindWindow("IEFrame", "VBForums - Visual Basic and VB .NET Discussions and More! - Microsoft Internet Explorer") Loop wPlace.Length = Len(wPlace) wPlace.showCmd = SW_SHOWNORMAL rRect.Left = 0 rRect.Top = 0 rRect.Right = (Screen.Width / Screen.TwipsPerPixelX) / 2 rRect.Bottom = (Screen.Height / Screen.TwipsPerPixelY) / 2 wPlace.rcNormalPosition = rRect lRet2 = SetWindowPlacement(lRet, wPlace) SetActiveWindow lRet Exit Sub MyError: MsgBox Err.Number & " - " & Err.Description End Sub





Reply With Quote