Windows API one-day training (35) outputdebugstring Function

Source: Internet
Author: User
During software development, what is the most time? It is actually debugging the code. After all, human thinking is from simple to complex processes, and natural cognitive processes are also from simple to complex. Therefore, when developing software, the first version is always easy to write, and then slowly add errors to handle, and add unexpected situations to those unexpected errors, it is called a bug. It is not easy to eradicate bugs in a software program. We should not only be familiar with the software process, but also have a better understanding of the software's objectives, you also need to know about this development platform, and of course you also need to constantly test whether different conditions have errors. The condition combination of the software is the Npower of 2, so it is impossible to test all the combinations. You can only choose the most important test, as long as it does not affect the use of the software, this software is even a piece of software that can make money. Don't expect this software to show no bugs at all. It's unrealistic, or the price is too high, as a result, the development cost of this software is too high, and the company cannot survive. Therefore, balancing usability and software bugs becomes an artistic thing. Different scenarios have different requirements and must not be perfect for perfection. The following describes how to use outputdebugstring to output debugging information to the development platform.

The outputdebugstring function declaration is as follows:

Winbaseapi
Void
Winapi
Outputdebugstringa (
_ In lpcstr lpoutputstring
);
Winbaseapi
Void
Winapi
Outputdebugstringw (
_ In lpcwstr lpoutputstring
);
# Ifdef Unicode
# Define outputdebugstring outputdebugstringw
# Else
# Define outputdebugstring outputdebugstringa
# Endif //! Unicode

An example of calling this function is as follows:
#001 //
#002 // response command.
#003 // Cai junsheng 2007/09/13 QQ: 9073204
#004 //
#005 lresult ccaiwinmsg: oncommand (int nid, int nevent)
#006 {
#007 // menu option command response:
#008 switch (NID)
#009 {
#010 case idc_createbtn:
#011 // display a button.
#012 if (! M_hbtn)
#013 {
#014 m_hbtn = createwindow (_ T ("button"), _ T ("button "),
#015 ws_visible | ws_child | bs_pushbutton,
#016 50,50, 100,32,
#017 m_hwnd, (hmenu) idc_btn, m_hinstance, null );
#018}
#019 break;
#020 case idc_btn:
#021 outputdebugstring (_ T ("Button Press/R/N "));
#022 break;
#023 default:
#024 return ccaiwin: oncommand (NID, nevent );
#025}
#026
#027 return 1;
#028}

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.