|
I am working with Jim Crafton on the VCF library
and I prepared the test case.
BTW we forgot to initialize filePath_:
ConversionClass() {
filePath_ = Path();
}
From MS help:
"illegal conversion; more than one user-defined conversion has been implicitly applied"
means:
"The compiler did not find an explicit conversion but did find a conversion, which it used."
If this is true, I wonder why we should have a warning.
If we have a chain of implicit conversions. Why we should make them explicit ?
In fact the fix:
String getFileName()
{
return (String)filePath_;
}
works, but I think there should be a way to make this conversion implicit without any warnings.
Otherwise what the conversion operators would be done for ?
And things would get pretty complicated if we should make explicit a chain of implicit conversion.
Both the fixes:
const String& getFileName()
and
inline operator const String2 () const
do not work, used together or not.
And nothing changes if I remove the function:
inline operator String2& () {
return filename_;
}
altogether and try the above fixes.
Should we consider this a MS bug and just eliminate the warning ?
|
|
|
|
|
No no.
Sorry. I tested against my original test case but a macro was altering the results.
Here are the true results:
String getFileName() {
return (String)filePath_;
}
works.
Eliminating the function as:
//inline operator String& () {
// return filename_;
//}
works.
Modifying:
NewString getFileName()
-->
const NewString& getFileName()
works.
Also:
-->
NewString& getFileName()
works.
Modifying
operator String () const
-->
operator const String () const
does not eliminate the warning.
|
|
|
|
|
Thanks a lot for the all answers !
As we could appropriately find a fix of the problem
Cheers,
Marcello
|
|
|
|
|
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
|
|
|
|