Thread: Open URL in new window

  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, 10:17 AM
  3. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 10:50 AM
  4. window doesn't open
    By eth0 in forum Windows Programming
    Replies: 12
    Last Post: 05-05-2005, 08: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