I want to open a web page at default browser at a specific position and also open another webpages at that one, not new task of that browser. maybe user opens new task of that browser but by clicking a button in my delphi program the selected web page have to open at first one. is that possible? my company wants me to program such thing BUT I do not know how to do. I really appricate any help. thanks.
Asked
Active
Viewed 897 times
1
-
1*How to open a web page by default browser at a specific position ?* You can use [`ShellExecuteEx`](http://msdn.microsoft.com/en-us/library/windows/desktop/bb762154%28v=vs.85%29.aspx) which will return you a process handle, then you need to find the *main window* and set its position. *How to open a new task (tab) in that browser instance ?* You would have to say to that process instance to open a file (for IE it might be like [`this way`](http://stackoverflow.com/q/10139727/960757), but I don't know what about the others). But maybe I'm wrong and it's easy. – TLama May 11 '12 at 13:32
-
1I can't understand the question. Position on screen? Or position within the document? And I can't make head nor tail of the bit about opening subsequent documents. – David Heffernan May 11 '12 at 13:35
-
1While it is not the default browser, TWebBrowser may meet the rest of your requirements because it is much easier (more straight forward) to control. – crefird May 12 '12 at 01:57
1 Answers
0
There are instructions here to open the default browser, but you may even be able to "run" a url, as you can from the Windows run command. You then need to retain the handle of that process so that you can do something with it.
To open a web page at a particular point you would ideally use a named anchor in the page, ie, the bit after a hash: http://www.w3schools.com/TAGS/tryit.asp?filename=tryhtml_a_name If you don't have control of the page and there are no named anchors you could try scrolling: How to scroll the scrollbar in external application via WinAPI?

Community
- 1
- 1

Jamie Kitson
- 3,973
- 4
- 37
- 50