|
-
Dec 4th, 2007, 04:27 AM
#1
Thread Starter
Hyperactive Member
[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.
-
Dec 4th, 2007, 04:41 AM
#2
Re: Shelling internet Explorer and then moving the window.
From MS help:
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)
-
Dec 4th, 2007, 05:01 AM
#3
Thread Starter
Hyperactive Member
Re: Shelling internet Explorer and then moving the window.
Thanks
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.
-
Dec 4th, 2007, 05:02 AM
#4
Re: Shelling internet Explorer and then moving the window.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 4th, 2007, 07:49 AM
#5
Thread Starter
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|