Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Using OutputDebugString
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Expand all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Buzz  
View profile  
 More options Jul 23 2001, 10:00 pm
Newsgroups: microsoft.public.windowsce.embedded
From: "Buzz" <b...@buzz.com>
Date: Mon, 23 Jul 2001 21:58:59 -0400
Local: Mon, Jul 23 2001 9:58 pm
Subject: Using OutputDebugString
I am developing an Windows CE 3.0 app using eVC.  I am using
OutputDebugString to send diagnostic messages while running in the eVC
development environment via an Ethernet port.

Is there anyway to capture these messages while NOT running in the eVC
development environment??  Is there a way to use WinDbg to capture these
messages, or is there an utility that comes with Platform Builder??

Thanks,


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Buzz  
View profile  
 More options Jul 24 2001, 10:01 am
Newsgroups: microsoft.public.win32.programmer.wince, microsoft.public.windowsce.embedded, microsoft.public.windowsce.targeted.device
From: "Buzz" <b...@buzz.com>
Date: Tue, 24 Jul 2001 09:59:37 -0400
Local: Tues, Jul 24 2001 9:59 am
Subject: Using OutputDebugString
I am using OutputDebugString to send diagnostic info while running my app
under the eVC debugger.  The target is running CE 3.0 and uses an Ethernet
connection for debugging.  Is there anyway to capture the output of
OutputDebugString without using the debugger??  Are there utilities that can
do this with the Ethernet connection (WinDbg, DBMON, etc.).   Is there an
easy way to make these work without having to jump thru the multitude of
development hoops inherent to Windows CE?

Thanx,

buzz


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marco Manfredini  
View profile  
 More options Jul 24 2001, 2:51 pm
Newsgroups: microsoft.public.win32.programmer.wince, microsoft.public.windowsce.embedded, microsoft.public.windowsce.targeted.device
From: ma...@technoboredom.net (Marco Manfredini)
Date: Tue, 24 Jul 2001 20:47:18 +0200
Local: Tues, Jul 24 2001 2:47 pm
Subject: Re: Using OutputDebugString
"Buzz" <b...@buzz.com> wrote in news:ewHfhjEFBHA.1556@tkmsftngp02:

> I am using OutputDebugString to send diagnostic info while running
> my app under the eVC debugger.  The target is running CE 3.0 and
> uses an Ethernet connection for debugging.  Is there anyway to
> capture the output of OutputDebugString without using the
> debugger??  Are there utilities that can do this with the Ethernet
> connection (WinDbg, DBMON, etc.).   Is there an easy way to make
> these work without having to jump thru the multitude of development
> hoops inherent to Windows CE?

You can open a UDP socket for output. Here is an example:

--- BEGIN FILE nclog.h ---

extern void nclog (const wchar_t *fmt, ...);
extern bool set_nclog_port(unsigned short x) { return wsa_bind(x); }

--- END FILE nclog.h ---

--- BEGIN FILE nclog.cpp ---

#include "winsock.h"
#include <stdarg.h>
#include <stdio.h>

static SOCKET wsa_socket=INVALID_SOCKET;
#pragma comment(lib , "winsock")

static unsigned short theLogPort;

// bind the log socket to a specific port.
static bool wsa_bind(unsigned short port)
{
                SOCKADDR_IN addr;
                addr.sin_family = AF_INET;
                addr.sin_port = htons(port);
                addr.sin_addr.s_addr = htonl(INADDR_ANY);
                int r=bind(wsa_socket,(sockaddr*)&addr,sizeof(addr));
                if (r==0) theLogPort=port;
                return (r==0);

}

// initialize everything, if the socket isn't open.
static bool wsa_init()
{
        if (wsa_socket != INVALID_SOCKET) return true;
        int r;
        WSADATA wd;
        BOOL bc=true;

        if (0 != WSAStartup(0x101, &wd)) goto error;
        wsa_socket=socket(PF_INET, SOCK_DGRAM, 0);
        if (wsa_socket == INVALID_SOCKET) goto error;
        r=setsockopt(wsa_socket, SOL_SOCKET, SO_BROADCAST, (char*)&bc,
sizeof(bc));
        if (r!=0) goto error;
        if (wsa_bind(9998)) return true; // bind to default port.
error:
        if (wsa_socket != INVALID_SOCKET) closesocket(wsa_socket);
        if (debug_mode) OutputDebugString(TEXT("nclog: TCP/IP Problem"));
        return false;

}

// can be called externally to select a different port for operations
bool set_nclog_port(unsigned short x) { return wsa_bind(x); }

static void wsa_send(const char *x)
{
        SOCKADDR_IN sa;
        sa.sin_family = AF_INET;
        sa.sin_port = htons(theLogPort);
        sa.sin_addr.s_addr = htonl(INADDR_BROADCAST);

        if (SOCKET_ERROR == sendto(wsa_socket,x,strlen(x), 0, (sockaddr*)
&sa, sizeof(sa)))
        {
                if (debug_mode) OutputDebugString(TEXT("nclog: Send
Error"));
        }

}

// format input, convert to 8-bit and send.
void nclog (const wchar_t *fmt, ...)
{
        va_list vl;
        va_start(vl,fmt);
        wchar_t buf[1024]; // to bad CE hasn't got wvnsprintf
        wvsprintf(buf,fmt,vl);
        wsa_init();
        char bufOut[512];
        WideCharToMultiByte(CP_ACP,0,buf,-1,bufOut,400, NULL, NULL);
        wsa_send(bufOut);

}

// finalize the socket on program termination.
struct _nclog_module
{
        ~_nclog_module()
        {
                if (wsa_socket!=INVALID_SOCKET)
                {
                        nclog("nclog goes down\n");
                        shutdown(wsa_socket,2);
                        closesocket(wsa_socket);
                }
        }

};

static _nclog_module module;

--- END FILE nclog.cpp ---

How to use? You simply put netcat.cpp and netcat.h in your project and
you go. Use it like printf:

nclog(L"The Window Handle is: %x\n",hwnd);

On your desktop, you need netcat to capture the output from your
program, i.e. you open a console and type:

netcat -lup 9998

This will instruct netcat to show you everything that comes to your UDP
socket 9998 (which is the default for netcat). Since nclog opens the
socket in broadcast mode, you don't have to give an target adress. (Be
sure to select a port which does not interfer with the network you are
living in)

If you have a "tee" Utility (for example from the cygwin tools), you can
also capture the output:

netcat -lup 999 | tee logfile

I don't use OutputDebugString anymore. This approach is much more
flexible. For example, I can filter the output with grep and have
multiple netcat's open to show me the output from different threads:

In one terminal:
 netcat -lup 9998 | grep "[xy thread]"

In another
 netcat -lup 9998 | grep "[main thread]"

just prefix your output and you can filter on it.

Or I can see how two different programs interact, by using different
port numbers. etc.pp.

Netcat is available from l0pht. See:

http://www.l0pht.com/~weld/netcat/

--
Marco


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marco Manfredini  
View profile  
 More options Jul 24 2001, 3:01 pm
Newsgroups: microsoft.public.win32.programmer.wince, microsoft.public.windowsce.embedded, microsoft.public.windowsce.targeted.device
From: ma...@technoboredom.net (Marco Manfredini)
Date: Tue, 24 Jul 2001 20:57:08 +0200
Local: Tues, Jul 24 2001 2:57 pm
Subject: Re: Using OutputDebugString
ma...@technoboredom.net (Marco Manfredini) wrote in
news:Xns90E8D42795805marcotechnobore@technoboredom.net:

Sorry: I copied the code from an exisiting file which had additional
functionality. You need to define a bool debug_mode which decides if
errors are reported via OutputDebugString. I hope you can get it to run.
--
Marco


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alessandro Gatti  
View profile  
 More options Jul 25 2001, 12:39 am
Newsgroups: microsoft.public.win32.programmer.wince, microsoft.public.windowsce.embedded, microsoft.public.windowsce.targeted.device
From: "Alessandro Gatti" <a...@4gatti.com>
Date: Tue, 24 Jul 2001 21:38:10 -0700
Local: Wed, Jul 25 2001 12:38 am
Subject: Re: Using OutputDebugString
whow! it's awesome and FAST! thx!!!!!!

alessandro

"Marco Manfredini" <ma...@technoboredom.net> wrote in message

news:Xns90E8D5D2DDF0marcotechnobore@technoboredom.net...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alessandro Gatti  
View profile  
 More options Jul 25 2001, 12:49 am
Newsgroups: microsoft.public.win32.programmer.wince, microsoft.public.windowsce.embedded, microsoft.public.windowsce.targeted.device
From: "Alessandro Gatti" <a...@4gatti.com>
Date: Tue, 24 Jul 2001 21:49:37 -0700
Local: Wed, Jul 25 2001 12:49 am
Subject: Re: Using OutputDebugString
BTW: how do you make it work for the x86em platform?

thx! Alessandro

"Alessandro Gatti" <a...@4gatti.com> wrote in message

news:OpCpcOMFBHA.2000@tkmsftngp05...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marco Manfredini  
View profile  
 More options Jul 25 2001, 10:26 am
Newsgroups: microsoft.public.win32.programmer.wince, microsoft.public.windowsce.embedded, microsoft.public.windowsce.targeted.device
From: ma...@technoboredom.net (Marco Manfredini)
Date: Wed, 25 Jul 2001 16:22:42 +0200
Local: Wed, Jul 25 2001 10:22 am
Subject: Re: Using OutputDebugString
"Alessandro Gatti" <a...@4gatti.com> wrote in
news:eEq$1UMFBHA.1392@tkmsftngp05:

> BTW: how do you make it work for the x86em platform?

I don't use the emulator.

a) It is too unstable. My installation of the Pocket Emulator dies with
an error in shell32.exe when I try to start the calendar or to show the
today screen. After the crash I casually have to logout to get rid of
the pieces.

b) It doesn't emulate properly. For my Projects, I've written a library
which allows me to code without including <windows.h> anymore. An
Application uses *exactly* the same code for Win32 and WinCE (no #ifdef
UNDER_CE anymore). I am testing against: Windows NT, Cassiopeia,
Journada, iPAQ. Casually also against a PalmPC 2.11 device. It always
works, but *never correctly* in the Emulator. Lots of subtle thing
happen there, windows receive button down events, but not the button up
event that follows etc.pp.

c) It does not support networking et. al. (thats why nclog doesn't work)

d) Too much to hassle to get it together with ADOCE or SQL Server CE and
other addons

If you have a network card, forget the emulator, it sucks. They or
somebody else should make an emulator which really emulates hardware and
runs an actual Windows CE image. (which would be a great thing for the
Platform Builder users as well, if they could configure an emulator for
their hardware to test-drive their images)

If your code isn't too CE specific, then maintain the code to run under
the Desktop. (Which is also very valuable, because you learn about the
API differences).

--
Marco


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Buzz  
View profile  
 More options Jul 25 2001, 11:21 am
Newsgroups: microsoft.public.win32.programmer.wince, microsoft.public.windowsce.embedded, microsoft.public.windowsce.targeted.device
From: "Buzz" <b...@buzz.net>
Date: Wed, 25 Jul 2001 10:17:26 -0500
Local: Wed, Jul 25 2001 11:17 am
Subject: Re: Using OutputDebugString
Thanks.  I will give it a try.

"Marco Manfredini" <ma...@technoboredom.net> wrote in message

news:Xns90E9A74B15247marcotechnobore@technoboredom.net...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sid Price  
View profile  
 More options Jul 25 2001, 1:09 pm
Newsgroups: microsoft.public.win32.programmer.wince, microsoft.public.windowsce.embedded, microsoft.public.windowsce.targeted.device
From: sidpr...@softtools.com (Sid Price)
Date: Wed, 25 Jul 2001 16:51:57 GMT
Local: Wed, Jul 25 2001 12:51 pm
Subject: Re: Using OutputDebugString

On Tue, 24 Jul 2001 20:47:18 +0200, ma...@technoboredom.net (Marco

Manfredini) wrote:

I went ot the URL but th elink for download seems broken. Is there an
ftp address for it?

Sid


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marco Manfredini  
View profile  
 More options Jul 25 2001, 4:41 pm
Newsgroups: microsoft.public.win32.programmer.wince, microsoft.public.windowsce.embedded, microsoft.public.windowsce.targeted.device
From: ma...@technoboredom.net (Marco Manfredini)
Date: Wed, 25 Jul 2001 22:40:18 +0200
Local: Wed, Jul 25 2001 4:40 pm
Subject: Re: Using OutputDebugString
sidpr...@softtools.com (Sid Price) wrote in news:3b5ef8f8.12298814
@msnews.microsoft.com:

> On Tue, 24 Jul 2001 20:47:18 +0200, ma...@technoboredom.net (Marco
> Manfredini) wrote:

> I went ot the URL but th elink for download seems broken. Is there an
> ftp address for it?

It's on the tools page after the redirection:
http://www.atstake.com/research/tools/index.html

See under "3. Network Utility Tools:"

--
Marco


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sid Price  
View profile  
 More options Jul 25 2001, 9:38 pm
Newsgroups: microsoft.public.win32.programmer.wince, microsoft.public.windowsce.embedded, microsoft.public.windowsce.targeted.device
From: sidpr...@softtools.com (Sid Price)
Date: Thu, 26 Jul 2001 01:38:03 GMT
Local: Wed, Jul 25 2001 9:38 pm
Subject: Re: Using OutputDebugString
Thanks, I found it,
Sid

On Wed, 25 Jul 2001 22:40:18 +0200, ma...@technoboredom.net (Marco


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google