Delphi uses outputdebugstring to debug programs and write system logs

Source: Internet
Author: User

Delphi uses outputdebugstring to debug programs and write system logs

Procedure increment (Sender: tobject); begin outputdebugstring ('ddddddd'); increment ('11'); end; Procedure increment (Sender: tobject); var evtsrchand: thandle; evtmsg: string; P: pointer; I: integer; Size: integer; Q: ^ byte; begin // register the event source with a name. This name is the 'source' column of the event list. // you can determine whether the event is successful. // Be sure to log off evtsrchand: = registereventsource (nil, 'test Project'); If evtsrchand = 0 thenbeginshowmessage ('event source registration failed! '); Exit; end; // record a string here // This string is displayed in the position selected in the second figure below. Evtmsg: = 'record string'; reportevent (evtsrchand, eventlog_information_type, 0, 0, nil, 1, 0, @ evtmsg, nil); // a piece of memory is recorded here, size size: = 32; // apply for getmem (p, size); Q: = P; // fill in this memory for I: = 0 to size-1 dobeginq ^: = I; Inc (Q); end; // The memory content is recorded here. The size is size, and the first byte pointer P // also has the description message msgevtmsg: = 'record a block of memory '; reportevent (evtsrchand, eventlog_information_type, 0, 0, nil, 1, size, @ evtmsg, P); freemem (p); // deregister the event source deregistereventsource (evtsrchand); end.

 

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.