Go language Windows Programming (1)-Simple pop-up message window

Source: Internet
Author: User

These days the company is relatively empty, and began to play Go language, found it can be written through a https://github.com/lxn/go-winapi go-winapi library windowsProgramSo it began to play, of course, there is a lot of it based on further encapsulation for development projects, such as https://github.com/lxn/walk. However, I did not do any projects, so I decided to use go-winapi to write it. The first program is the simplest pop-up message box, for example:

And accidentally exposed node. js. Note that the background is only the desktop background, which is irrelevant to the program. The message pop-up window is involved.

If you have said so much, go firstCodeDon't paste the code, continue, so that some people will not be lazy and refuse to practice, copy and run them directly, and then say yes.

 

Write the code, compile the code, and then generate an executable file of .exe, and double-click it to run. Of course, if you compile it directly, there will be a command line Prompt window after the pop-up message box for running,

If it cannot be displayed, add the parameter go build-ldflags-hwindowsgui test. Go during compilation.

 

Of course, the go-winapi package must be installed after the above program is compiled successfully. Run Go get github.com/lxn/go-winapi to install it. In this way, the go-winapi package will be installed in the directory specified by gopath.

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.