Click here to Skip to main content
15,891,943 members
Articles / Mobile Apps

A simple solution to see the inside of your code

Rate me:
Please Sign up or sign in to vote.
4.69/5 (13 votes)
25 May 2006CPOL2 min read 54.9K   906   43  
A simple solution to see the inside of your code.
// EsiListenerCPP.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"
#include <string>
#include "PipeClient.h"


PipeClient pipeClient;

BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{
    return TRUE;
}


void WINAPI Trace(char* szMessage)
{
	char    szAppPath[MAX_PATH] = "", dateTime[40] = {0};
	std::string strAppName, strFileName, strMessage;

	 SYSTEMTIME st;
     GetLocalTime(&st);

	 sprintf( dateTime, "%0000d/%00d/%00d %00d:%00d:%00d" ,st.wYear,st.wMonth,st.wDay,st.wHour,st.wMinute,st.wSecond);

	::GetModuleFileName(0, szAppPath, MAX_PATH);

	strAppName = szAppPath;
	strAppName = strAppName.substr(strAppName.rfind("\\") + 1);

	strMessage = strAppName;
	strMessage += SEPARATOR;
	strMessage += SEPARATOR;
	strMessage += dateTime;
	strMessage += SEPARATOR;
	strMessage += szMessage;
		
	pipeClient.Send( (char*)strMessage.data() );
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Romania Romania
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions