Hi,

My experience sucessfully do a hello world in windows whit gtk3.

First I Create a hello world program in monodevelop 5 on Linux Mint 18.

Second I add gtk-sharp3 nuguet package from https://github.com/cra0zy/gtk-sharp3-nuget

Test in linux if the program works.

Then in a clean windows install, I install msys2 and ONLY install gtk+3.22 and friends.

Then I copy from C:\msys32\mingw32 the "bin" folder, the "etc" folder and "share" folder, to a gtk3 folder in my program folder.

In the program I add the gtk3 folder to the path.

The whole project is in:

https://sendgb.com/XkOhtzepYFV


class MainClass
    {
        public MainClass(string[] args)
        {
            CheckGtk3Win32 ();
            Gtk.Application.Init();
            GLib.ExceptionManager.UnhandledException+= Gui.OneFunctionToRuleThemAll;
            System.IO.StreamReader sr = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("GtkSharpNuget.GtkSharpNuget.ui"));
            Gui.InitObjects(sr.ReadToEnd());
            sr.Close();
            Gui.window1.DeleteEvent+= (o, a) => {
                Gtk.Application.Quit();
            };
            Gui.scalebutton1.Orientation = Gtk.Orientation.Horizontal;
            Gui.window1.ShowAll ();
            Gtk.Application.Run ();
        }
        public static void Main(string[] args)
        {
            new MainClass (args);
        }

        [System.Runtime.InteropServices.DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode, SetLastError = true)]
        [return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)]
        static extern bool SetDllDirectory (string lpPathName);

        [System.Runtime.InteropServices.DllImport("user32.dll", CharSet=System.Runtime.InteropServices.CharSet.Auto)]
        public static extern int MessageBox(IntPtr hWnd, String text, String caption, int options);
        bool SetGtk3Directory()
        {
            string location = Directory.GetCurrentDirectory ();
            //TODO: check build version of GTK#
            if (!File.Exists (Path.Combine (location, "gtk3\\bin", "libgtk-3-0.dll"))) {
                return false;
            }
            var path = Path.Combine (location, @"gtk3\bin");
            try {
                if (SetDllDirectory (path)) {
                    Console.WriteLine("Seteo de GTK sharp 3 {0}",path);
                    return true;
                }
            } catch (EntryPointNotFoundException) {
                Console.WriteLine("Error entry point");
            }
            return false;
        }

        void CheckGtk3Win32()
        {
            if(System.Environment.OSVersion.Platform == PlatformID.Win32Windows ||
                System.Environment.OSVersion.Platform == PlatformID.Win32NT ||
                System.Environment.OSVersion.Platform == PlatformID.Win32S){
                //CheckSystem.Get45PlusFromRegistry();
                if (!SetGtk3Directory()) {
                    Console.WriteLine("No se ha detectado GTK Sharp");
                    MessageBox(System.IntPtr.Zero, "No se ha detectado GTK Sharp, este programa no funcionará sino tiene GTK Sharp instalado", "Error", 0);
                }
            }
        }


Jesus Eguiluz
El 09/01/18 a las 06:50, Pedro Larouca escribió:
Hi Baltazar,

I really have no interest running gtk3 on windows because gtk2 is stable and mature. Xamarin team is not going to port at this time, they haven’t abandoned. Meanwhile , there are several second party ports for this, have you tried some ? Gtk3 is available for windows at 

Please share your experiences, ty 

On 9 Jan 2018, at 09:13, Baltasar García Perez-Schofield <[email protected]> wrote:

Hi,

AFAIK, in Windows there is no possibility to install the GTK libraries apart from the GTK# ones. You need the whole package, since in Windows it is not possible to locate them. There is still only a Gtk# 2 package available, since Xamairn has abandoned (then, again, AFAIK) the port of Gtk# to Gtk+3.

Of course, I'm not a Xamarin developer, maybe there is an environment variable that can be created for that purpose.

-- Baltasar


El lun., 8 ene. 2018 a las 20:06, <[email protected]> escribió:
Hello List,

   This is my firstt, I am havaing a problem using GTK#3 in Windows.

   When I install GTK#3 using NuGet in visual studio, it needs to have gtk+ 3.22  libraries.  If I provide the msys2 gtk+3.22 binaries,
it says it is unable to load them.   When I provide gtk+ 3.8.1 libraries, they are detected the and says it needs 3.22 instead.

I also built from the latest source code 3.22, and it also will not run with these libraries (I don't even get a version conflict message, they are unrecognized binaries).

Thank you,
 Bill Foster
_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.dot.net/mailman/listinfo/gtk-sharp-list
_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.dot.net/mailman/listinfo/gtk-sharp-list


_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.dot.net/mailman/listinfo/gtk-sharp-list


_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.dot.net/mailman/listinfo/gtk-sharp-list

Reply via email to