Problem with moving Form from C# ( Visual Studio 2013 )

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

Problem with moving Form from C# ( Visual Studio 2013 )

Postby SourceSkyBoxer » Mon Jan 02, 2017 3:45 pm

Hello dear people,

I am new here. Thanks for welcome!

I have problem with Form1 if I pressed mouseclick left than form can't move

How do I use code?
Code: Select all
chromeBrowser.GetBrowser().GetHost().SendMouseClickEvent()


I really want create awesome html5 wrapper like NW.js or Electron because I have learn 25 % for C# But it sees very simple. But not all like try catch or for catch - I am still learnning. Thanks

How do I C# for Linux and MacOS? With MonoDevelop?
Is it correct? I need download binary package for Linux and MacOS from cef last stable biunary packages right?

And can I embed libraries and data / binaries into single executable? They can not steal my resources.
Costura.Fody? Or I create simple assembly or ResourcesMainferstStream ( I don't know if I am not sure )

Thanks! I am sorry for sometimes my bad English!
SourceSkyBoxer
Newbie
 
Posts: 3
Joined: Mon Jan 02, 2017 3:35 pm

Re: Problem with moving Form from C# ( Visual Studio 2013 )

Postby amaitland » Tue Jan 03, 2017 4:52 pm

You've failed to mention which wrapper your using.

I personally would just use electron.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am

Re: Problem with moving Form from C# ( Visual Studio 2013 )

Postby SourceSkyBoxer » Sat Apr 29, 2017 4:41 am

Hello amaitland thanks sorry for longer answer.

PS: I am sorry I really want fix your github because From my Visual Studio 2017 shows error line "toolStripContainer". Please replace to this.Controls:Add(browser); Please believe me! I don't joke you. I show proof.
Code: Select all
using System.Windows.Forms;
using CefSharp;
using CefSharp.WinForms;

namespace EmbedTest
{
    public partial class BrowserForm : Form
    {
        private readonly ChromiumWebBrowser browser;
        private CefSettings settings;
        public BrowserForm()
        {
            InitializeComponent();

            settings = new CefSettings();
            settings.CefCommandLineArgs.Add("enable-npapi", "1");
            Cef.Initialize(settings);

            //browser = new ChromiumWebBrowser("https://www.adobe.com/de/software/flash/about/")
            browser = new ChromiumWebBrowser("chrome://plugins/")
            {
                Dock = DockStyle.Fill,
            };

            this.Controls.Add(browser);
        }
    }
}

And compiler doesn't show any errors That is why "toolStripContainer" is unknown method. Why do you not like my improvement? I am trying to explain to you.

Do you know how do I embed all dlls, dat and bin into exe?
But CefSharp libraries need local because program starts unexpected - I check task manager. my own browser crashes because it need CefSharp libraries.
Make sure CefSharp libraries stay local disk.
And thrid party plugins should embed - If you want dlls into local disk for next version for plugins.
Code: Select all
   static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AsemblyResolver); // It is event to read from embedded dlls, dats and bins
            Application.Run(new BrowserForm());
        }


And example likes this:
Code: Select all
        static Assembly CurrentDomain_AsemblyResolver(object sender, ResolveEventArgs args)
        {
            // NPSWF32.dll ( NPAPI Flash Player )
            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("EmbedTest.NPSWF32.dll"))
            {
                byte[] assemblyData = new byte[stream.Length];
                stream.Read(assemblyData, 0, assemblyData.Length);
                return Assembly.Load(assemblyData);
            }
            // add more stream1, stream2, .....
        {
       


Make sure all embedded files into "Embedded Resource"
And build it. and go to x64 or x86 directory and debug or release than remove copied dlls from embedded resources example libcef.dll was embedded in exe and local disk should remove and check if application shows - yay we don't need to get required libraries in root directory of application. PS: chrome://plugins looks like it doesn't know where is libcef.dll If my application embeds important dlls in executable's data. Why does it happen because chrome://plugins shows path to libcef.dll But it didn't hold if libraries not local disk. Does it anybody fix?

Example:
Photo I am sorry that it is very big because my monitor has 27 inch.

Thanks
SourceSkyBoxer
Newbie
 
Posts: 3
Joined: Mon Jan 02, 2017 3:35 pm

Re: Problem with moving Form from C# ( Visual Studio 2013 )

Postby amaitland » Sat Apr 29, 2017 6:17 am

CefSharp is Windows only, if you need Linux and Mac OS support you'll have to look at other options.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am

Re: Problem with moving Form from C# ( Visual Studio 2013 )

Postby Czarek » Sat Apr 29, 2017 6:43 am

There is no out of the box Linux/Mac support in other C# bindings for CEF. However there is a fork of CefGlue that is intended for Mac. There is also a PR in ChromiumFx that added Linux support. You might still find issues, however there are some fixes available, so it might work for you, or not. The links you will have to find on your own.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Problem with moving Form from C# ( Visual Studio 2013 )

Postby SourceSkyBoxer » Sat Apr 29, 2017 10:53 am

What do you mean? What do you say about macOS and Linux?

I mean embedded dlls, bins, dats and paks into resource of executable's data.

If you write C# than it is easy to write
Code: Select all
Assembly. ...
static Assembly MyResolver(object o, ResolverEventArgs re)
{
 ....
}
And you make sure "Embedded Resource" to select

And C++ same to but it is very harder than C#
Code: Select all
class myclass : public
{
 public:
    AppDomain::CurrentDomain->AssemblyResolve += gcnew ResolveEventHandler(&CurrentDomain_AsemblyResolver);

    Assembly^ CurrentDomain_AsemblyResolver(Object^ Sender, ResolveEventArgs^ args)
   {
      auto stream = Assembly::GetExecutingAssembly()->GetManifestResourceStream("Namespace.library.dll");
      try
      {
         array<Byte>^ assemblyData = gcnew array<Byte>(stream->Length);
         stream->Read(assemblyData, 0, assemblyData->Length);
         return Assembly::Load(assemblyData);
      }
      finally
      {
         delete stream;
      }
   }
}
IS it correct select to "Include content" or What is word of C# embedding resources into executable's data
SourceSkyBoxer
Newbie
 
Posts: 3
Joined: Mon Jan 02, 2017 3:35 pm

Re: Problem with moving Form from C# ( Visual Studio 2013 )

Postby fddima » Sat Apr 29, 2017 4:06 pm

SourceSkyBoxer wrote:I mean embedded dlls, bins, dats and paks into resource of executable's data.


Man. This called in many ways in AV software, but just stop do it. We (users) hate every this kind software piece. Why? Because:
1. AV think that you are file dropper or * dropper.
2. Performance is terrible: there is impossible to work with any prefetch techniques in that case.
3. Why instead just not create installer?

PS: Native modules can't be loaded in that fashion.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 21 guests