If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
I'd like to setup an icon for my wxWidgets application, so that it appears both on the .exe file, as well as in the taskbar and top-left corner of each application window. What would be the best way to achieve this? I've searched for a solution for a while now, and I came across posts referring to either .xpm files or .ico files, the SetIcon() method, and using the resource.rc file. After many attempts I was unable to get it to work. I'm not sure if I'm editing the resource.rc contents correctly. Currently, my resource.rc file looks as follows:
��/ / M i c r o s o f t V i s u a l C + + g e n e r a t e d r e s o u r c e s c r i p t .
/ /
# i n c l u d e " r e s o u r c e . h "
# d e f i n e A P S T U D I O _ R E A D O N L Y _ S Y M B O L S
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ /
/ / G e n e r a t e d f r o m t h e T E X T I N C L U D E 2 r e s o u r c e .
/ /
# i n c l u d e " w i n r e s . h "
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
# u n d e f A P S T U D I O _ R E A D O N L Y _ S Y M B O L S
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / E n g l i s h ( U n i t e d S t a t e s ) r e s o u r c e s
# i f ! d e f i n e d ( A F X _ R E S O U R C E _ D L L ) | | d e f i n e d ( A F X _ T A R G _ E N U )
L A N G U A G E 2 1 , 1
# i f d e f A P S T U D I O _ I N V O K E D
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ /
/ / T E X T I N C L U D E
/ /
1 T E X T I N C L U D E
B E G I N
" r e s o u r c e . h \ 0 "
E N D
2 T E X T I N C L U D E
B E G I N
" # i n c l u d e " " w i n r e s . h " " \ r \ n "
" \ 0 "
E N D
3 T E X T I N C L U D E
B E G I N
" \ r \ n "
" \ 0 "
E N D
# e n d i f / / A P S T U D I O _ I N V O K E D
# e n d i f / / E n g l i s h ( U n i t e d S t a t e s ) r e s o u r c e s
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
# i f n d e f A P S T U D I O _ I N V O K E D
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ /
/ / G e n e r a t e d f r o m t h e T E X T I N C L U D E 3 r e s o u r c e .
/ /
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
# e n d i f / / n o t A P S T U D I O _ I N V O K E D
BTW, if you actually have an icon with multiple sizes of the image (16x16, 32x32,...), I would as always recommend using SetIcons() instead of SetIcon().
Severity Code Description File Line
Error RC1015 cannot open include file 'wx/msw/wx.rc'. C:\Users\kwret\Documents\Visual Studio 2019\Projects\PomiarWiazki_wxWidgets\PomiarWiazki_wxWidgets\PomiarWiazki_wxWidgets.rc 15
Am I not pasting the #include statement in the right place in the .rc file?
As for PB's suggestion, I am using only one icon (16x16 in size).
��/ / M i c r o s o f t V i s u a l C + + g e n e r a t e d r e s o u r c e s c r i p t .
/ /
# i n c l u d e " r e s o u r c e . h "
aaaa ICON icon.ico
#include "wx/msw/wx.rc"
# d e f i n e A P S T U D I O _ R E A D O N L Y _ S Y M B O L S
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ /
/ / G e n e r a t e d f r o m t h e T E X T I N C L U D E 2 r e s o u r c e .
/ /
# i n c l u d e " w i n r e s . h "
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
# u n d e f A P S T U D I O _ R E A D O N L Y _ S Y M B O L S
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / E n g l i s h ( U n i t e d S t a t e s ) r e s o u r c e s
# i f ! d e f i n e d ( A F X _ R E S O U R C E _ D L L ) | | d e f i n e d ( A F X _ T A R G _ E N U )
L A N G U A G E 2 1 , 1
# i f d e f A P S T U D I O _ I N V O K E D
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ /
/ / T E X T I N C L U D E
/ /
1 T E X T I N C L U D E
B E G I N
" r e s o u r c e . h \ 0 "
E N D
2 T E X T I N C L U D E
B E G I N
" # i n c l u d e " " w i n r e s . h " " \ r \ n "
" \ 0 "
E N D
3 T E X T I N C L U D E
B E G I N
" \ r \ n "
" \ 0 "
E N D
# e n d i f / / A P S T U D I O _ I N V O K E D
# e n d i f / / E n g l i s h ( U n i t e d S t a t e s ) r e s o u r c e s
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
# i f n d e f A P S T U D I O _ I N V O K E D
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ /
/ / G e n e r a t e d f r o m t h e T E X T I N C L U D E 3 r e s o u r c e .
/ /
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
# e n d i f / / n o t A P S T U D I O _ I N V O K E D