Outputdebugstring output debugging information

Source: Internet
Author: User

In Win32ProgramYou can use the outputdebugstring function to output debugging information. The output result can be viewed in the vsintegrated environment, or the result can be captured using the tool dbgview.exe. The original form of the function is as follows:

Outputdebugstring

The outputdebugstring function sends a string to the debugger for display.

 

Void outputdebugstring (
Lpctstr lpoutputstring
);

 

Parameters
Lpoutputstring
[In] pointer to the null-terminated string to be displayed.
Return values
This function does not return a value

Because the outputdebugstring parameter is a string, we hope to support variable parameters like printf in actual use. You can use the following method to achieve this effect:

Inline bool mydbgstr (lpcstr lpszformat ,...)
{
Va_list ARGs;
Int nbuf;
Tchar szbuffer [512];

Va_start (ARGs, lpszformat );

Nbuf = _ vsnprintf (szbuffer, sizeof (szbuffer) * sizeof (tchar), lpszformat, argS );
Assert (nbuf> 0 );
Outputdebugstring (szbuffer );

Va_end (ARGs );
}

ArticleSource: http://www.diybl.com/course/3_program/c++/cppsl/200866/122894.html

# Pragma optimize ("", off). Disable optimization.

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.