Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Can't prevent new window opening!

Can't prevent new window opening!

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialc++helpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    henryfonda
    wrote on last edited by
    #1

    Hi there, can anyone tell me how to stop a link opening in a new window and just use the existing window?? For example: I've got a little explorer app(MFC) with 2 windows. The left side displays the C:/drive and the right side displays a FTP address. The left window navigates fine, but the right side insists on opening a new explorer window when I click on a link, instead of changing inside its own window. When the ne window opens... that navigates fine... just the way I want the right side widow to. Its probably something stupid, knowing me... definately something stupid:) But I've tried a bunch of stuff for the last 24 hours now and nothing stops it opening in a new window! Help! Henry F

    A S 2 Replies Last reply
    0
    • H henryfonda

      Hi there, can anyone tell me how to stop a link opening in a new window and just use the existing window?? For example: I've got a little explorer app(MFC) with 2 windows. The left side displays the C:/drive and the right side displays a FTP address. The left window navigates fine, but the right side insists on opening a new explorer window when I click on a link, instead of changing inside its own window. When the ne window opens... that navigates fine... just the way I want the right side widow to. Its probably something stupid, knowing me... definately something stupid:) But I've tried a bunch of stuff for the last 24 hours now and nothing stops it opening in a new window! Help! Henry F

      A Offline
      A Offline
      agentnem
      wrote on last edited by
      #2

      If I understand you correctly, the right pane is actually an HtmlView displaying a web page. In any case, to redirect a link to a specific window you have to use the "target" property. For example: // somewhere in an HTML file Click here "target" accepts any of the following: _blank, which opens the link in a new window _self, which opens the link in the current window _parent, which opens the link in the parent window _top, which opens the link in the top most window Hope this helps.

      H 1 Reply Last reply
      0
      • A agentnem

        If I understand you correctly, the right pane is actually an HtmlView displaying a web page. In any case, to redirect a link to a specific window you have to use the "target" property. For example: // somewhere in an HTML file Click here "target" accepts any of the following: _blank, which opens the link in a new window _self, which opens the link in the current window _parent, which opens the link in the parent window _top, which opens the link in the top most window Hope this helps.

        H Offline
        H Offline
        henryfonda
        wrote on last edited by
        #3

        Thanks for the reply man, but(as usual) its not the HTML I need to change. Basically its an Explorer Window displaying content on a server via FTP: Naviagte2(_T(ftp://whatever.com),NULL,NULL) It displays fine but when I want to open a folder - it launches a new explorer window outside the application and displays the info in that window. Is there some way of controlling this so that all clicked links open inside the application only? thanks :-)

        1 Reply Last reply
        0
        • H henryfonda

          Hi there, can anyone tell me how to stop a link opening in a new window and just use the existing window?? For example: I've got a little explorer app(MFC) with 2 windows. The left side displays the C:/drive and the right side displays a FTP address. The left window navigates fine, but the right side insists on opening a new explorer window when I click on a link, instead of changing inside its own window. When the ne window opens... that navigates fine... just the way I want the right side widow to. Its probably something stupid, knowing me... definately something stupid:) But I've tried a bunch of stuff for the last 24 hours now and nothing stops it opening in a new window! Help! Henry F

          S Offline
          S Offline
          Scott H Settlemier
          wrote on last edited by
          #4

          handle OnBeforeNavigate2, cancel the navigation if it's to another window, and navigate to the url just cancelled... something like that.

          H 1 Reply Last reply
          0
          • S Scott H Settlemier

            handle OnBeforeNavigate2, cancel the navigation if it's to another window, and navigate to the url just cancelled... something like that.

            H Offline
            H Offline
            henryfonda
            wrote on last edited by
            #5

            Clever idea! Any chance you could scribble the code down? I'll buy u a cup of tea :-)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups