Click here to Skip to main content
15,904,934 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow do i use cout in Visual Studio .NET? Pin
Anonymous23-Oct-02 2:53
Anonymous23-Oct-02 2:53 
AnswerRe: How do i use cout in Visual Studio .NET? Pin
Joaquín M López Muñoz23-Oct-02 3:05
Joaquín M López Muñoz23-Oct-02 3:05 
GeneralVisual C++ CD needed Pin
puzzolino23-Oct-02 2:51
puzzolino23-Oct-02 2:51 
GeneralRe: Visual C++ CD needed Pin
23-Oct-02 10:50
suss23-Oct-02 10:50 
GeneralRe: Visual C++ CD needed Pin
puzzolino23-Oct-02 21:29
puzzolino23-Oct-02 21:29 
GeneralDynamic Link Library Pin
homer66623-Oct-02 2:16
homer66623-Oct-02 2:16 
GeneralRe: Dynamic Link Library Pin
Joaquín M López Muñoz23-Oct-02 2:23
Joaquín M López Muñoz23-Oct-02 2:23 
GeneralCatching OutputDebugStrings Pin
adrian cooper23-Oct-02 2:10
adrian cooper23-Oct-02 2:10 
I though about creating a Edit window in my app that when called
at runtime would catch all OutputDebugStrings that my program was
making.

After some nosing about on MSDN about catching OutPutDebugStrings i
wrote a thread function as below and called it from a menu option. The
idea was to eventually create a small window that would be updated with
any OutPutDebugStrings that were caught.

<br />
UINT catchDebugString(LPVOID param)<br />
{<br />
	TCHAR myChar[1024];<br />
	DWORD dwProcessId = GetCurrentProcessId();<br />
	HANDLE hHandle = OpenProcess( PROCESS_ALL_ACCESS, false, dwProcessId );<br />
<br />
	if ( DebugActiveProcess( dwProcessId ) == 0 )<br />
        return 0;<br />
<br />
	DEBUG_EVENT de;<br />
    <br />
	while ( WaitForDebugEvent( &de, INFINITE ) )<br />
	{   <br />
		if ( de.dwDebugEventCode == OUTPUT_DEBUG_STRING_EVENT )<br />
		{<br />
			OUTPUT_DEBUG_STRING_INFO deStr = de.u.DebugString; <br />
<br />
   			ReadProcessMemory(hHandle, deStr.lpDebugStringData, myChar, 1024, NULL);<br />
		}<br />
	                     <br />
		if ( EXIT_PROCESS_DEBUG_EVENT == de.dwDebugEventCode )<br />
			break;<br />
<br />
		ContinueDebugEvent( de.dwProcessId, de.dwThreadId, DBG_CONTINUE );<br />
	}     <br />
<br />
	return 1;<br />
}<br />



All was well until i found out i cant call DebugActiveProcess( dwProcessId )
with my own process id , there by making it so i cant catch my own OutputDebugStrings.

I just wondered if anyone out there had any ideas of how i could overcome this
problem or if there is another way to catch OutputDebugStrings??

cheers



AdrianCooper me;
while(CKitchen::beerInFridge()) {
me.watchTV();
me.consumeBeer(myKitchen.getBeerCan());
}
GeneralRe: Catching OutputDebugStrings Pin
jmkhael23-Oct-02 2:16
jmkhael23-Oct-02 2:16 
GeneralRe: Catching OutputDebugStrings Pin
adrian cooper23-Oct-02 3:55
adrian cooper23-Oct-02 3:55 
GeneralRe: Catching OutputDebugStrings Pin
Daniel Turini23-Oct-02 4:38
Daniel Turini23-Oct-02 4:38 
GeneralRe: Catching OutputDebugStrings Pin
adrian cooper23-Oct-02 5:00
adrian cooper23-Oct-02 5:00 
GeneralRe: Catching OutputDebugStrings Pin
Joaquín M López Muñoz23-Oct-02 4:20
Joaquín M López Muñoz23-Oct-02 4:20 
GeneralRe: Catching OutputDebugStrings Pin
adrian cooper23-Oct-02 5:01
adrian cooper23-Oct-02 5:01 
GeneralHelp on drawing a CButton in an ActiveX control Pin
J.Sheets23-Oct-02 1:31
sussJ.Sheets23-Oct-02 1:31 
GeneralGetLast Error and Watch window Pin
adrian cooper23-Oct-02 1:15
adrian cooper23-Oct-02 1:15 
GeneralFlexGrid "Unsupported operation"?! Pin
paulccc22-Oct-02 22:50
paulccc22-Oct-02 22:50 
GeneralRe: FlexGrid "Unsupported operation"?! Pin
benjymous23-Oct-02 0:51
benjymous23-Oct-02 0:51 
GeneralCTabCtrl in a Dialog Bar Pin
stevenoliver22-Oct-02 22:47
stevenoliver22-Oct-02 22:47 
GeneralRe: CTabCtrl in a Dialog Bar Pin
Ravi Bhavnani23-Oct-02 11:40
professionalRavi Bhavnani23-Oct-02 11:40 
GeneralRe: CTabCtrl in a Dialog Bar Pin
stevenoliver23-Oct-02 22:28
stevenoliver23-Oct-02 22:28 
GeneralRe: CTabCtrl in a Dialog Bar Pin
Ravi Bhavnani24-Oct-02 1:35
professionalRavi Bhavnani24-Oct-02 1:35 
GeneralRe: CTabCtrl in a Dialog Bar Pin
stevenoliver24-Oct-02 1:40
stevenoliver24-Oct-02 1:40 
GeneralRe: CTabCtrl in a Dialog Bar Pin
Ravi Bhavnani24-Oct-02 1:45
professionalRavi Bhavnani24-Oct-02 1:45 
GeneralRe: CTabCtrl in a Dialog Bar Pin
stevenoliver24-Oct-02 1:49
stevenoliver24-Oct-02 1:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.