Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

MyDebug.h

Go to the documentation of this file.
00001 /* ***********************************************************************************
00002         Writer:         Sebastien Bloc
00003         Copyright:      2003-2004
00004         eMail:          sebastien.bloc@free.fr
00005         URL:            http://mignonsoft.free.fr
00006 
00007         This program is free software; you can redistribute it and/or
00008         modify it under the terms of the GNU General Public License
00009         as published by the Free Software Foundation; either version 2
00010         of the License, or (at your option) any later version.
00011 
00012         This program is distributed in the hope that it will be useful,
00013         but WITHOUT ANY WARRANTY; without even the implied warranty of
00014         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015         GNU General Public License for more details.
00016 http://www.gnu.org/copyleft/gpl.html
00017 *********************************************************************************** */
00018 
00023 #ifndef INCLUDE_MY_DEBUG_H
00024 #define INCLUDE_MY_DEBUG_H
00025 
00026 #include <windows.h>
00027 #include <stdio.h>
00028 #include <stdarg.h>
00029 #include "MyString.h"
00030 
00043 class MyDebug  
00044 {
00045         public:
00046         static HWND hWndServer;
00047 
00048         static BOOL Send(char *message)
00049         {
00050                 COPYDATASTRUCT cpd;
00051                 cpd.dwData = 0;
00052                 cpd.cbData = (DWORD)strlen(message)+1;
00053                 cpd.lpData = (void *)message;
00054                 return (BOOL)SendMessage(MyDebug::hWndServer, WM_COPYDATA, NULL,(LPARAM)&cpd);
00055         }
00056 
00057 public:
00058         MyDebug()
00059         {
00060                 Start();
00061         }
00062 
00063         ~MyDebug()
00064         {
00065         }
00066 
00067         static void Start()
00068         {
00069                 if (!hWndServer)
00070                 {
00071                         FindServer();
00072                 }
00073         }
00074 
00075         static BOOL FindServer()
00076         {
00077                 hWndServer = FindWindow(NULL,"DebugServer");
00078                 return hWndServer?TRUE:FALSE;
00079         }
00080 
00081         static BOOL SendEvent(char *tabName,char *message,...)
00082         {
00083                 MyString buffer;
00084 
00085                 char temp[1024];
00086                 va_list args;
00087                 va_start(args,message);
00088                 vsprintf(temp,message,args);
00089 
00090                 buffer<<"#event \""<<tabName<<"\" "<<temp<<"\n";
00091                 return Send(buffer);
00092         }
00093 
00094         static BOOL SendLine(char *tabName,char *message,...)
00095         {
00096                 MyString buffer;
00097 
00098                 char temp[1024];
00099                 va_list args;
00100                 va_start(args,message);
00101                 vsprintf(temp,message,args);
00102 
00103                 buffer<<"#line \""<<tabName<<"\" "<<temp<<"\n";
00104                 return Send(buffer);
00105         }
00106 };
00107 
00108 #endif 
00109 

Generated on Fri Aug 20 19:19:47 2004 for 3d Controls by doxygen 1.3.6