Unanswered How to add a warning or bar to the IE window in C#

  • 3 กุมภาพันธ์ 2555 21:37
     
     

    I'd like to add a warning/bar to the top of the HTML document, similar to what Google Translate does with the Google Toolbar, or similar to the ActiveX warning shown sometimes by IE. I do not ant to add a toolbar, or a band at the bottom of the window. I'm trying to do this in C# .Net but cannot find any example.

    You can see http://stackoverflow.com/questions/9008885/how-to-show-a-warning-or-bar-from-bho-in-internet-explorer for pictures of toolbar I'm trying to replicate.

ตอบทั้งหมด

  • 6 กุมภาพันธ์ 2555 8:08
     
     
    As that link said, you need to inject JS+HTML to achieve this.
    NEU_ShieldEdge
  • 6 กุมภาพันธ์ 2555 18:21
     
     
    The Google toolbar does not inject HTML on the page to show the toolbar. So there has to be another way of doing it.
  • 6 กุมภาพันธ์ 2555 22:14
     
     
    If you insist upon a native way of doing it, you can call CreateWindow and create a window.  Now you have to move all of IE's internal windows around to make it fit.  Since that hierarchy is an internal implementation detail that can and does change between versions of IE, you're asking for a world of pain. 
  • 7 กุมภาพันธ์ 2555 3:48
     
     
    Is it possible in C#? The examnples I've found with CreateWindo were all in C++.
  • 7 กุมภาพันธ์ 2555 5:39
     
     
    One way of doing it in C# you would be to write a class that inherits from NativeWindow and override CreateParams.  Then the class calls CreateWindow for you, but you'll have to fill in pretty much anything else.

    Jose R. MCP

  • 7 กุมภาพันธ์ 2555 17:40
     
     
    Oh man.  Why do you want to do this again?
  • 7 กุมภาพันธ์ 2555 23:17
     
     
    I'd like to display a warning for some pages, even if the website is down (no HTML to insert the awrning into). Also, sometimes I'd like to dispaly a toolbar-like control for some websites only, and it does not make sense to show an emty toolbar for 90% of the sites.