|
Hi
I have an application which call functions in a DLL. When debugging I use AfxMessageBox() but I want to use TRACE macro. If debugging I think I can use TRACE macro and it will output to the output window but is that only for my application? If I want the output from functions in my DLL how do I get trace output?
Can I direct my trace output to a file?
|
|
|
|
|
Anonymous wrote:
...is that only for my application?
No, TRACE() outputs to the debug window regardless. The DLL, however, will have to be compiled in debug mode, and the EXE will have to be started via F5.
Anonymous wrote:
Can I direct my trace output to a file?
Not by default. This utility does that, and more.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
In general, trace does nothing in release builds.
However using DbgView from www.sysinternals.com you can view outputs of OutputDebugString (TRACE...)
Are there TRACE calls in the dll?
Check _CrtDbgReport for secod question
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thank you for your help. That program looks very interesting. I have tried to use it with these results:
Running my program in debug but nothing happens. I have set afxTraceEnabled = TRUE; in CMyApp::InitInstance() but I see no output in the output window but I also see no output window in Visual C++ 6.0 anyway. Is there a way to display it while debugging?
I use the DebugView program and nothing happens whether I run my program in debug (F5) or just run it. If I place a call to OutputDebugString(""); though I then get my TRACE calls displayed in the DebugView program. Already it has detected a memory leak so that is good (or bad).
Can you tell me what am I missing?
|
|
|
|
|
Now I have removed the OutputDebugString() call and now when I run (not in debug using F5) the DebugView program displays the TRACE calls only in my application and not from the DLL even though I have TRACE calls in my DLL. It is now that this happens whether I include afxTraceEnabled = TRUE; or not. It is very useful like it is now but I cannot still get any output from my DLL.
|
|
|
|
|
I've tried:
<br />
ShowWindow(SW_SHOW);<br />
ActivateWindow();<br />
SetForegroundWindow();<br />
My window is a derived CDialog.
What's missing ?
|
|
|
|
|
Use SetWindowPos() and the HWND_TOP flag for zorder.
e.g.
SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
Ant.
|
|
|
|
|
This has no affect
The only thing that changes something is :
SetForegroundWindow();
It makes my window's entry in the task-bar blink, but the window doesn't jump to the foreground.
Perhaps this is privellege related, my call to SetForegroundWindow(); is done in response to a BroadcastSystemMessage with the BSF_ALLOWSFW flag. I don't thinks is the cause though as my window does start blinking...
|
|
|
|
|
Strange!?!
Could you please post a snip of your code where you are using this.
Ant.
|
|
|
|
|
Sender:
Sure, snippet below.
My guess is that my window-style or default-message-handling somehow affects this... But I can't point out exactly what.
<br />
DWORD target = BSM_APPLICATIONS;<br />
BroadcastSystemMessage( BSF_ALLOWSFW | BSF_POSTMESSAGE,<br />
&target,<br />
m_guiMsgId,<br />
0,<br />
0);<br />
<br />
Receiver:
Sure:
<br />
if (IsIconic()) ShowWindow(SW_RESTORE);<br />
SetForegroundWindow();<br />
|
|
|
|
|
OK, how did you call SetWindowPos() when you called it instead of SetForegroundWindow() ?
Ant.
|
|
|
|
|
SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
|
|
|
|
Um, that is the correct syntax and should put the dialog on top. I can't think what would be preventing it in your situation.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? - David Williams (Little Britain)
|
|
|
|
|
SetWindowPlacement
SetWindowPos
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I don't follow...
SetWindowPos on itself didn't do the job...
|
|
|
|
|
How did you call it?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
fatal error C1083: Cannot open include file: 'time': No such file or directory
Error executing cl.exe.
How can i solve this problem?
thanks...
|
|
|
|
|
Errr.. Try perhaps the correct file name (I don't think "time" is a valid header file ). Perhaps "Time.h" will work better .
|
|
|
|
|
Please advice best TreeList controls for .NET ?
I need to choose what to buy.
DevExpress suite -to compare with.
What is else best graphical suites there are on market for .NET ?
Thanks.
|
|
|
|
|
hi, it's possible to create a file in ram and accessing it with fopen/fread funcion?I've got some libraries that works on an mp3 file and I need them to work only on first 30 seconds, since they work on file stream and ends when EOF is reached I tought to create a file, copy first 30 seconds into and work in ram as it is a real file, but I don't know how... thanks
Paolo
|
|
|
|
|
Check the memory mapped files
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
As Papa mentions check out memory mapped files - but you will need to use the Win32 read/write calls not fread/fwrite. You'll need to use ReadFile/WriteFile using the file handle that you get back from creating the mem mapped file. Check out CreateFileMapping (I was curious about this too ) and it's related functions on MSDN.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
thanks to Papa amd Jim, but I've lib code that uses fread/fopen ( for portability iusse), so I can't use Win32 API, I think I'll copy the file into a new one on HD and then delete it after my works on it, thanks
bests
Paolo
|
|
|
|
|
How do use lib file. Do i just have to declare the lib name in the link tab. How do i get the function names that are exposed by the library??
|
|
|
|
|
Instead of putting it in the link tab, you can also use:
#pragma comment(lib, "libfile")
I suppose, if you have the DLL of the LIB file, you can view the dependencies from the "Depends" Visual Studio tool. It will list the functions exported.
Hope this helps.
* Don't wish it was easier, wish you were better! *
|
|
|
|