[RESOLVED] Shelling internet Explorer and then moving the window.
Hey Guys,
I managed to shell internet explorer to a specific URL but:
a) it only shells to the taskbar, regardless of me trying to open it vbmaximised
b) I can't seem to move the window (I am using this article http://support.microsoft.com/kb/q242308/
to find the handle from the instance returned by the shell), but it won't move ?!?! (using movewindow, or setwindowpos).
Any help, very much appreicated !
Code:
Dim hinst As Long ' Instance handle from Shell function.
Dim hWndApp As Long ' Window handle from GetWinHandle.
Dim buffer As String ' Holds caption of Window.
Dim numChars As Integer ' Count of bytes returned.
'Still only hits the taskbar
hinst = Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE www.google.ie", vbMaximizedFocus)
'search for handle
hWndApp = GetWinHandle(hinst)
If hWndApp <> 0 Then
MoveWindow hWndApp, 12, 24, 3333, 222, 1
'Doesn't Work!
DestroyWindow hWndApp
End If
Thanks
Chubby.
Re: Shelling internet Explorer and then moving the window.
From MS help:
Quote:
If the Shell function successfully executes the named file, it returns the task ID of the started program. The task ID is a unique number that identifies the running program.
The Task ID is not the same thing as the handle.
Use the ShellExecute API to get a valid handle.
You may also need to introduce a small delay before calling MoveWindow - the window has to be fully loaded first. (I've got some c0d somewhere that demos something similar - but it may be a while before I find it)
Re: Shelling internet Explorer and then moving the window.
Thanks :thumb:
I'm using the task id to find the handle using the code in the article: http://support.microsoft.com/kb/q242308/ this gives a valid windows handle, but not quite sure its the right 'valid' windows handle ? If that makes sense.. i.e. it is a handle, but not convinced its the right one..
Chub.
Re: Shelling internet Explorer and then moving the window.
Re: [RESOLVED] Shelling internet Explorer and then moving the window.
:thumb: :thumb: :thumb:
exactly wot I needed.
Thanks
Chub.