Custom ICON with mingw

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom ICON with mingw

chuck.oliveira

Hello Mingw users:

I am trying to create a custon ICON for my mingw win32 app on Windown 7.

I install mingw and followed the "Building Win32 GUI Application Using Mingw":


I was able to get the application to compile and operate properly as describe by the website. Thanks.

I then edited the ICOM (Win32/res/Application.ico) with the GreenFish ICON editor. Recompiled and ran the app.

Still the same default icon.

Has anyone had any luck creating a custom ICON  using mingw in Win7  (32 bit)?

Thanks
Chuck


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Custom ICON with mingw

Keith Marshall
On 23/03/15 01:55, [hidden email] wrote:
> I then edited the ICOM (Win32/res/Application.ico) with the GreenFish
> ICON editor. Recompiled and ran the app. Still the same default icon.

Is your application.ico specified in a resource file, for use with your
application? If so, did you also recompile that, and link the resultant
object file with the application? (If not, then that's the step you are
missing).

> Has anyone had any luck creating a custom ICON using mingw in Win7
> (32 bit)?

Yes ... mingw-get.exe uses an icon borrowed from Synaptic, (a package
manager GUI, used by several GNU/Linux distributions as a wrapper for
APT). You can find the source in the MinGW.org git repository:
https://sourceforge.net/p/mingw/mingw-get/ci/master/tree/
https://sourceforge.net/p/mingw/mingw-get/ci/master/tree/src/guimain.rc

--
Regards,
Keith.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Custom ICON with mingw

Gisle Vanem-3
Keith Marshall wrote:

> Yes ... mingw-get.exe uses an icon borrowed from Synaptic, (a package
> manager GUI, used by several GNU/Linux distributions as a wrapper for
> APT). You can find the source in the MinGW.org git repository:
> https://sourceforge.net/p/mingw/mingw-get/ci/master/tree/
> https://sourceforge.net/p/mingw/mingw-get/ci/master/tree/src/guimain.rc

This got me interested in building wtklite myself. I did
as the instruction told me (md build; cd build; make). But:
   ...
   g++ -c -MMD -MP  -g -O2 -o vsashctl.o -D VSASH_IMPLEMENTATION ../sashctrl.cpp
   g++ -c -MMD -MP  -g -O2 -o strres.o ../strres.cpp
   g++ -c -MMD -MP  -g -O2 -o wtkraise.o ../wtkraise.cpp
   ../wtkraise.cpp:42:21: fatal error: wtklite.h: No such file or directory
   compilation terminated.

(I guess you have wtklite.h in your C_INCLUDE_PATH). This patch
fixed it for me:

--- Makefile.in.orig    2015-03-23 13:33:17 +0000
+++ Makefile.in 2015-03-23 13:32:59 +0000
@@ -49,7 +49,7 @@
  CC = @CC@
  CXX = @CXX@
  CPPFLAGS = @CPPFLAGS@
-CXXFLAGS = @CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@ -I${srcdir}
  CFLAGS = @CFLAGS@
  OBJEXT = @OBJEXT@



--
--gv

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Custom ICON with mingw

Keith Marshall
On 23/03/15 13:06, Gisle Vanem wrote:

> Keith Marshall wrote:
>
>> Yes ... mingw-get.exe uses an icon borrowed from Synaptic, (a package
>> manager GUI, used by several GNU/Linux distributions as a wrapper for
>> APT). You can find the source in the MinGW.org git repository:
>> https://sourceforge.net/p/mingw/mingw-get/ci/master/tree/
>> https://sourceforge.net/p/mingw/mingw-get/ci/master/tree/src/guimain.rc
>
> This got me interested in building wtklite myself. I did
> as the instruction told me (md build; cd build; make). But:
>    ...
>    g++ -c -MMD -MP  -g -O2 -o vsashctl.o -D VSASH_IMPLEMENTATION ../sashctrl.cpp
>    g++ -c -MMD -MP  -g -O2 -o strres.o ../strres.cpp
>    g++ -c -MMD -MP  -g -O2 -o wtkraise.o ../wtkraise.cpp
>    ../wtkraise.cpp:42:21: fatal error: wtklite.h: No such file or directory
>    compilation terminated.
Ouch!

> (I guess you have wtklite.h in your C_INCLUDE_PATH).

I don't, as it happens, but I do seem to have an uncommitted change in
my local tree, to correct this; thanks for the reminder.

> This patch fixed it for me:
>
> --- Makefile.in.orig    2015-03-23 13:33:17 +0000
> +++ Makefile.in 2015-03-23 13:32:59 +0000
> @@ -49,7 +49,7 @@
>   CC = @CC@
>   CXX = @CXX@
>   CPPFLAGS = @CPPFLAGS@
> -CXXFLAGS = @CXXFLAGS@
> +CXXFLAGS = @CXXFLAGS@ -I${srcdir}
>   CFLAGS = @CFLAGS@
>   OBJEXT = @OBJEXT@
>
My chosen alternative is attached: I elected to use a quoted include,
rather than the bracketed form.

--
Regards,
Keith.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe

wtkraise.diff (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Custom ICON with mingw

Gisle Vanem-3
Keith Marshall wrote:

> My chosen alternative is attached: I elected to use a quoted include,
> rather than the bracketed form.

Good choice.

BTW. I also made a quick GNU makefile targeting MSVC v18 (attached).
Your use of an variable-sized array is still not supported in MSVC v18
(A C99/C++11 feature). So I patched wtkchild.cpp like:

+++ ./wtkchild.cpp      2015-03-23 13:55:24 +0000
@@ -41,6 +41,7 @@
     #define WIN32_LEAN_AND_MEAN

     #include <stdio.h>
+#include <string.h>
     #include "wtklite.h"

     namespace WTK
@@ -60,8 +61,8 @@
           /* On failure, compose diagnostic message, and bail out.
            */
           const char *fmt = "%s: CreateWindow FAILED";
-      char description[1 + snprintf( NULL, 0, fmt, ClassName )];
-      snprintf( description, sizeof( description ), fmt, ClassName );
+      char *description = (char*) alloca (strlen(fmt) + strlen(ClassName) + 1);
+      sprintf( description, fmt, ClassName );
           throw( runtime_error( description ) );
         }
         /* On success, return the window handle.


I think alloca() is ~100 times faster than snprintf() on any compiler.

MSVC also needed this:

--- wtklite-orig/sashctrl.cpp   2013-08-19 11:24:17 +0000
+++ ./sashctrl.cpp      2015-03-23 13:57:43 +0000
@@ -151,6 +151,7 @@
            */
           WindowObjectReference( GetParent( AppWindow ))->AdjustLayout();
         }
+    return (1);
       }

MSVC++ complained about "must return a value". But I'm not sure the significance
of the ret-val.

--
--gv




------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe

Makefile.MSVC (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: wtklite implementation; was: Custom ICON with mingw

Keith Marshall
On 23/03/15 14:45, Gisle Vanem wrote:
> BTW. I also made a quick GNU makefile targeting MSVC v18 (attached).

I have no interest in maintaining an MSVC port; however, if you would
like to commit to doing so, I would certainly be willing to include your
contribution in the repository.

> Your use of an variable-sized array is still not supported in MSVC v18
> (A C99/C++11 feature).

Shame on Microsoft; 15+ years after ratification of this standard, and
their vendor lock-in strategies still preclude its adoption.

> So I patched wtkchild.cpp like:
>
> +++ ./wtkchild.cpp      2015-03-23 13:55:24 +0000
> @@ -41,6 +41,7 @@
>      #define WIN32_LEAN_AND_MEAN
>
>      #include <stdio.h>
> +#include <string.h>
>      #include "wtklite.h"
>
>      namespace WTK
> @@ -60,8 +61,8 @@
>            /* On failure, compose diagnostic message, and bail out.
>             */
>            const char *fmt = "%s: CreateWindow FAILED";
> -      char description[1 + snprintf( NULL, 0, fmt, ClassName )];
> -      snprintf( description, sizeof( description ), fmt, ClassName );
> +      char *description = (char*) alloca (strlen(fmt) + strlen(ClassName) + 1);
> +      sprintf( description, fmt, ClassName );

Your replacement is not equivalent to my original expression; it does
not correctly compute the required character array size.

>            throw( runtime_error( description ) );
>          }
>          /* On success, return the window handle.
>
>
> I think alloca() is ~100 times faster than snprintf() on any compiler.

That may be so, but in claiming this as justification for the change,
you weaken your case.  See, the trade off is not between alloca() and
snprintf(), but between alloca() and GCC's own internal adjustment of
the stack pointer to accommodate the run-time dimensioned array; the
latter must surely be at least as fast as the former, if not faster.

In addition, you trade off calling strlen() twice against calling
snprintf() once; I wouldn't like to say which is faster, without a
rigorous benchmark test.

> MSVC also needed this:
>
> --- wtklite-orig/sashctrl.cpp   2013-08-19 11:24:17 +0000
> +++ ./sashctrl.cpp      2015-03-23 13:57:43 +0000
> @@ -151,6 +151,7 @@
>             */
>            WindowObjectReference( GetParent( AppWindow ))->AdjustLayout();
>          }
> +    return (1);
>        }
>
> MSVC++ complained about "must return a value".

Not standards compliant, but certainly a justifiable complaint.  This is
a bug; thanks for catching it.

> But I'm not sure the significance of the ret-val.

It doesn't really have any, at present, but 'return EXIT_SUCCESS;' would
seem to be a more logical choice.

--
Regards,
Keith.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe