Open URL in new window

This is a discussion on Open URL in new window within the Windows Programming forums, part of the Platform Specific Boards category; I'm using ShellExecuteEx to open up a browser. Is there any way to make it always open in a new ...

  1. #1
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Open URL in new window

    I'm using ShellExecuteEx to open up a browser. Is there any way to make it always open in a new window (similar to html:s "target = _blank")?

    Code:
    BOOL CDialogAbout::OpenUrl(CONST std::string& Url)
    {
    	SHELLEXECUTEINFO Info;
    
    	ZeroMemory(&Info, sizeof(SHELLEXECUTEINFO));
    	Info.cbSize = sizeof(SHELLEXECUTEINFO);
    	Info.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI;
    	Info.lpFile = Url.c_str();
    	Info.hInstApp = GetModuleHandle(NULL);
    	Info.nShow = SW_SHOWNORMAL;
    
    	if(!ShellExecuteEx(&Info))
    	{
    		Error.SetMessage("Unable to open \"" + Url + "\"!");
    		return FALSE;
    	}
    
    	return TRUE;
    }
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  2. #2
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312
    I used ShellExecute() in one of my programs, but sometimes it opened a new window and sometimes it didn't.
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  2. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 11:17 AM
  3. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 11:50 AM
  4. window doesn't open
    By eth0 in forum Windows Programming
    Replies: 12
    Last Post: 05-05-2005, 09:34 PM
  5. Click button on dialog box to open window.
    By ooosawaddee3 in forum Windows Programming
    Replies: 1
    Last Post: 11-29-2002, 08:53 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21