locked
Using flash plugin in a C# application ?

    Question

  • Hey !

    I made a browser application in visual c#. Everything is working fine so far, but I have a question.

    When I navigate to a webpage like youtube, my browser obviously will not be able to play any videos because my browser is not compatible with flash plugin.

    Is there any way to work around this problem ?

    Also, I want to make the web browser go to the home page when the user presses Alt + Home. I have tried the following method and it did not work:

    private void Form1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
            {
                if (e.Alt && e.KeyCode == Keys.Home) webBrowser1.GoHome();
            }
    

    Any suggestion for that one ?

    Thanks everyone !

     

    Monday, April 05, 2010 3:28 PM

Answers

All replies

  • For solving flash player issue the only workaround is to install the flash player plugin for internet explorer.

    For the second question instead of handling the event of the form handle the event of Web browser control.


    Thanks,
    A.m.a.L
    [MVP Visual C#]
    Dot Net Goodies
    Don't hate the hacker, hate the code
    Monday, April 05, 2010 4:17 PM
  • To handle keydown event in WebBrowser control, Use the PreviewKeyDown with the WebBrowser control

    private void WebBrowserControl1_PreviewKeyDown(Object sender, PreviewKeyDownEventArgs e)(object sender, PreviewKeyDownEventArgs e)
            {
                if (e.Alt && e.KeyCode == Keys.Home) webBrowser1.GoHome();
            }
    sd
    You need to install adobe flash plug-in in your PC, to play in youtube videos and animations.
    Monday, April 05, 2010 4:55 PM
  • How do I do the plugin installation ? I am sorry but I am actually new to visual c# so can you explain it a bit further please ?

    Thanks :D

    Monday, April 05, 2010 5:01 PM
    • Edited by A.m.a.L Hashim Monday, April 05, 2010 5:13 PM link
    • Marked as answer by Chaos5687 Monday, April 05, 2010 11:02 PM
    Monday, April 05, 2010 5:06 PM
  • so, i downloaded and my web browser app still can't play videos on youtube etc. What now ?

    Do i have to implement anything in my code related to using flash player ?

    I also know that adobe flash player is not meant to be used in 64bit applications ? May that be the source of the problem ?

    Monday, April 05, 2010 5:15 PM
  • Have you gone through the links i have placed in the above post?
    Thanks,
    A.m.a.L
    [MVP Visual C#]
    Dot Net Goodies
    Don't hate the hacker, hate the code
    Monday, April 05, 2010 5:20 PM
  • Yup, I did and tried using axWebBrowser, that's what they used in one of the links you have given. I am trying to use axWebBrowser controller, and cannot use the correct syntax.

    Wouldn't this be the correct syntax?

    axWebBrowser1.Navigate(new Uri("http://www.google.com"));

    Monday, April 05, 2010 5:33 PM
  • Yup, I did and tried using axWebBrowser, that's what they used in one of the links you have given. I am trying to use axWebBrowser controller, and cannot use the correct syntax.

    Wouldn't this be the correct syntax?

     

    axWebBrowser1.Navigate(new
     Uri("http://www.google.com"
    ));
    http://www.c-sharpcorner.com/UploadFile/mahesh/WebBrowserInCS12072005232330PM/WebBrowserInCS.aspx

    Thanks,
    A.m.a.L
    [MVP Visual C#]
    Dot Net Goodies
    Don't hate the hacker, hate the code
    Monday, April 05, 2010 5:47 PM
  • I have one more question:

    Before I give up, i will try compiling as x86 application. Can anyone explain me how to do so? Couldn't figure out where to change the target Cpu option.

    Monday, April 05, 2010 8:11 PM
  • 1. In VS 2008, Goto Build menu->select Configuration Manager. It will open Configuration Manager dialogbox.

    2. There will be a grid under the title 'Project contexts(check the project configurations to build or deploy'. Your project name is displayed in the grid.

    3.  Under platform column, Click the dropdown arrow and select 'New' It wil open 'New  Project Platform' dialog box.  Select x86 from the 'New Platform' dropdown. Click Ok and again close the dialogbox

    Monday, April 05, 2010 10:22 PM
  • Hello Chaos5687,

     

    Considering that many developers in this forum ask how to manipulate WebBrowser component (enabling flash, suppressing error messages, proxy support), rotate or flip images, my team has created a code sample for this frequently asked programming task in Microsoft All-In-One Code Framework. You can download the code samples at:

     

    VBWebBrowserWithProxy

     

    http://bit.ly/VBWebBrowserWithProxy

     

    CSWebBrowserWithProxy

     

    http://bit.ly/CSWebBrowserWithProxy

     

    With these code samples, we hope to reduce developers’ efforts in solving the frequently asked

    programming tasks. If you have any feedback or suggestions for the code samples, please email us: onecode@microsoft.com.

    ------------

    The Microsoft All-In-One Code Framework (http://1code.codeplex.com) is a free, centralized code sample library driven by developers' needs. Our goal is to provide typical code samples for all Microsoft development technologies, and reduce developers' efforts in solving typical programming tasks.

    Our team listens to developers’ pains in MSDN forums, social media and various developer communities. We write code samples based on developers’ frequently asked programming tasks, and allow developers to download them with a short code sample publishing cycle. Additionally, our team offers a free code sample request service. This service is a proactive way for our developer community to obtain code samples for certain programming tasks directly from Microsoft.

    Thanks

    Microsoft All-In-One Code Framework

    Thursday, March 24, 2011 10:33 AM