Teach you to add icons for the Go program under win

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

It's a pleasure to add icons to your own compiled programs. Here's how to add an icon to the Go program on the Windows platform:

  1. First you need to prepare the icon files, such as Myapp.ico.
  2. Second, prepare a generic ico.manifest program description file
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"><assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="SomeFunkyNameHere" type="win32"/><dependency><dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/></dependentAssembly></dependency><asmv3:application><asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"><dpiAware>true</asmv3:windowsSettings></asmv3:application></assembly>

  3. Execute "Go get github.com/akavel/rsrc" to download the source code of SYSO File Generator tool and compile and install using "Go Install"

  4. Execute "rsrc.exe-manifest ico.manifest-o myapp.syso-ico Myapp.ico" to generate the resource file Myapp.syso

  5. Copy Myapp.syso to your own project directory, it is best to specify the directory to compile the system (such as "xxx_windows"), and the directory should be import into the project, and then the normal compiler can automatically add icons

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.