Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ShellExecute uses existing window

Status
Not open for further replies.

AndyGroom

Programmer
May 23, 2001
972
GB
I'm using ShellExecute to open an HTM file, I've noticed that if there's already a copy of Internet Explorer running the HTM file opens in that window rather than starting a new instance of IE. How can I call ShellExecute so that it forces a new window to open regardless of that else is already open?


- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Try excuting the IE.exe and then running the same code. it's a pain but that should work.
 
Thing is though that if you double-click a HTM file in Explorer it opens in a new window - I thought that was exactly the same as doing a ShellExecute?

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Hi,

Could you post the code you are using with ShellExecute, i have just tried to recreate your problem but have been unsuccessful as the code I am using always seems to open a new explorer window.

Cheers

Harleyquinn

---------------------------------
For tsunami relief donations
 
When someone clicks on an HTM filename (from a list) I do the following:

a& = ShellExecute(Me.hwnd, "open", URL, "", "", SW_ShowNormal)

where URL is the full path and filename of the HTM file.

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
If URL is an actual URL (rather than a locally stored HTM document) I would be tempted to go with something similar to Dan688's suggestion. Something like:
Code:
Shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE [URL unfurl="true"]http://www.tek-tips.com/viewthread.cfm?qid=1033280&page=1",[/URL] vbNormalFocus
ShellExecute might be a better way to do it but I can't at the moment find a way around it opening the file in an already open IE window.

Hope this helps

Harleyquinn

---------------------------------
For tsunami relief donations
 
Thanks for all the help.

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top