Wrox Programmer Forums
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 24th, 2005, 02:09 AM
Authorized User
Join Date: Nov 2005
Posts: 15
Thanks: 5
Thanked 0 Times in 0 Posts
Default PInvoke

Hi All
Could Anyone Please tell me how to write PInvoke by using "OutputDebugString"
for the tracelistener

namespace System.Diagnostics {
      using System;
      using System.Text;

      public abstract class TraceListener : MarshalByRefObject,
                             IDisposable {

         protected TraceListener () {

         protected TraceListener(string name) {
             this.listenerName = name;

         public virtual string Name {
            get {

             set { listenerName = value; }
     public abstract void Write(string message);

         public virtual void Write(object o) {
             if (o == null) return;

         public abstract void WriteLine(string message);

         public virtual void WriteLine(object o) {
             WriteLine(o == null ? "" : o.ToString());

Old November 26th, 2005, 03:21 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma

Hi, I think posting a query twice wont serve your purpose as well and as much as being more clear would. Like what do mean by "....write PInvoke by using "OutputDebugString"..". Do you mean you want to USE OutputDebugString in your C# programm using PInvoke.

Secondly, if also mention as to WHY WOULD YOU want to do the things that you are doing, that helps others understand the query better and may be you even get a suggestion on performing the task in some more convinient way.

For this query though, PInvoke is not a hard to pull off trick, but it certainly is tricky. You will find good examples in the documentation for it. What you need to find out is whether you CAN call a function defined in Kernel32.lib and if you can will it work for the debugger associated with C# .NET app.

Ankur Verma

Similar Threads
Thread Thread Starter Forum Replies Last Post
PInvoke jack_3 C# 0 November 25th, 2005 08:02 PM
Pinvoke problems gavh C# 2 July 27th, 2004 05:55 PM
Error: Invalid PInvoke metadata format shahchi1 General .NET 1 May 26th, 2004 08:16 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.