|
My program crashed when it invoked one dll's function with debug mode.My code is below.
DVDErrorThrower err;
try {
err = m_session->BeginDiscAccess(hModule, device, DAM_READ_ONLY, 0, 0);
}
catch(dvd_eng_error e)
{
return E_FAIL;
}
The breakpoint is in _CRT_DEBUGGER_HOOK.
*******************************************************************************/
#include <dbgint.h>
#ifdef _DEBUG
#include <internal.h>
#include <limits.h>#include <mtdll.h>
#include <malloc.h>
#include <stdlib.h>
_CRT_ALLOC_HOOK _pfnAllocHook = _CrtDefaultAllocHook;
/***
*int _CrtDefaultAllocHook() - allow allocation
*
*Purpose:
* allow allocation
*
*Entry:
* all parameters ignored
*
*Exit:
* returns TRUE
*
*Exceptions:
*
*******************************************************************************/
int __cdecl _CrtDefaultAllocHook(
int nAllocType,
void * pvData,
size_t nSize,
int nBlockUse,
long lRequest,
const unsigned char * szFileName,
int nLine
)
{
return 1; /* allow all allocs/reallocs/frees */
}
#endif /* _DEBUG */
int _debugger_hook_dummy;
#ifdef _M_IA64
#undef _CRT_DEBUGGER_HOOK
#define _CRT_DEBUGGER_HOOK __crt_debugger_hook
#endif /* _M_IA64 */
__declspec(noinline)
void __cdecl _CRT_DEBUGGER_HOOK(int _Reserved)
{
/* assign 0 to _debugger_hook_dummy so that the function is not folded in retail */
(_Reserved);
_debugger_hook_dummy = 0;
}
and the callstack is like below:
> msvcr80.dll!_crt_debugger_hook(int _Reserved=) Line 65 C
msvcr80.dll!_invoke_watson(const wchar_t * pszExpression=0x00000000, const wchar_t * pszFunction=0x00000000, const wchar_t * pszFile=0x00000000, unsigned int nLine=0, unsigned int pReserved=0) Line 181 + 0x7 bytes C++
msvcr80.dll!_invalid_parameter_noinfo() Line 99 + 0xc bytes C++
TnAPIEngine.dll!05c0531e()
[Frames below may be incorrect and/or missing, no symbols loaded for NeroAPIEngine.dll]
TnAPIEngine.dll!05d920b0()
ntdll.dll!77b21843()
ntdll.dll!77b216dc()
msvcr80.dll!malloc(unsigned int size=189077260) Line 163 + 0x63 bytes C
mfc80u.dll!operator new(unsigned int nSize=0) Line 349 + 0x3 bytes C++
TnAPIEngine.dll!05d925e9()
TnAPIEngine.dll!05dc89fe()
And my Pc's environoment is :
Vista ultimate.
visual stdio 2005 sp1
but if I ran my program step by step ,it would catch the exception the function threw. And also with release mode.the program worked well!
I'm crazy.
Can anybody help me?
|
|
|
|
|
|
I have installed it.but the bug also display.
|
|
|
|
|
try cathcing all exceptions with catch(...){}
If u can Dream... U can do it
|
|
|
|
|
I have tried it,but it is useless.
|
|
|
|
|
Then try isolating the problem with that dll function. (remove the parts which smells some problems). likewise try again..
I think there is project specific settings for exceptions , Give a look into that..
All the best friend.
If u can Dream... U can do it
|
|
|
|
|
yeath,you are right,I have tried it.the result is that my program can catch the exception.
But which project settings would be possible for this exception?
I compared difference of project's settings between debug mode and release mode.
But they are same except for runtime library,and others I guess would't cause this problem.
Multi-thread Dll is set under release mode,and Multi-thread Debug Dll is set under debug mode.
If I set Multi-thread Debug Dll as runtime library under release,the program will be fine in that function but other functions,
If I set multi-thread dll as runtime library under debug,the problem is still exists.
|
|
|
|
|
waiting on line! thanks!
I like vc ,hope to talk about much with fans of vc!
|
|
|
|
|
You can use TVM_INSERTITEM and TVINSERTSTRUCT in which TVINSERTSTRUCT::itemex.iIntegral is for specifying the height. Through this you can set different height for each items.
- NS -
|
|
|
|
|
Hi! everyone!
I happened a problem now. I want to implement a transparent button. So I override the class of CButton. When I want to get the background of button, I use the GetParent() to get the CWnd* of the dialog the button in at first. But the point I get isn't the dialog's. It is the point of the desktop! Then I use GetParentOwner(). But the point it returned is same as GetParent(). So I don't know how to resolve this problem. Is there anyone who know how to resolve it? Thx!
regards!
|
|
|
|
|
i think if you can use the virtual function.i don't really understand just my feeling .
|
|
|
|
|
I use Getparent() in the OnEraseBkgnd(CDC *pDC) to get the CWnd* of the dialog. And then I can copy the background of the button. The code is as following:
if(!m_bHasErased)<br />
{<br />
CRect rc;<br />
GetClientRect(&rc);<br />
ClientToScreen(&rc);<br />
CWnd *wndParent=GetParentOwner();<br />
CDC *parentDC=wndParent->GetDC();<br />
ScreenToClient(&rc);<br />
CDC memDC;<br />
memDC.CreateCompatibleDC(parentDC);<br />
CBitmap *oldbmp=memDC.SelectObject(&m_bmpBG);<br />
<br />
memDC.BitBlt(0,0,rc.Width(),rc.Height(),parentDC,rc.left,rc.top,SRCCOPY);<br />
<br />
memDC.SelectObject(oldbmp);<br />
wndParent->ReleaseDC(parentDC);<br />
m_bHasErased=TRUE;<br />
}<br />
return CButton::OnEraseBkgnd(pDC);<br />
Then I copy this background to rect in OnPaint() as following:
void CTransBT::OnPaint()<br />
{<br />
CPaintDC dc(this);
CBrush brush;<br />
brush.CreatePatternBrush(&m_bmpBG);<br />
CRect rc;<br />
GetClientRect(&rc);<br />
CDC memDC;<br />
memDC.CreateCompatibleDC(&dc);<br />
memDC.FillRect(&rc,&brush);<br />
dc.BitBlt(0,0,rc.Width(),rc.Height(),&memDC,0,0,SRCCOPY);<br />
memDC.DeleteDC();<br />
}<br />
But the content be drawed is the background under the dialog, not under the button's.
|
|
|
|
|
How did you confirm that your getting the desktops pointer?
whiteclouds wrote: ClientToScreen(&rc);
whiteclouds wrote: ScreenToClient(&rc);
I think this two functions will cancel out each other. the second one should be like
wndParent->ScreenToClient(&rc); isnt it?
|
|
|
|
|
Naveen.R wrote: How did you confirm that your getting the desktops pointer?
Because the content br drawn on button is part of the desktop, not the dialog as I hope.
|
|
|
|
|
Did you try modifing as I said?
|
|
|
|
|
I had tried already. The result was same as before.
|
|
|
|
|
I suggest you to use the GetParent() instead of GetParentOwner().
|
|
|
|
|
Also other things is that you should not capture this from earse background function. Because you will get some white background or some other junk items when you capture so. This problem can be solved if you use the WM_PRINTCLIENT message.
|
|
|
|
|
I'm pleased to see your reply. Thx at first. But I can't find the message you refered. This message isn't existed.
|
|
|
|
|
whiteclouds wrote: But I can't find the message you refered
here it is WM_PRINTCLIENT[^]
|
|
|
|
|
Naveen.R wrote: here it is WM_PRINTCLIENT[^]
I can't find this message in winuser.h of my system. But I can find it in MSDN. Why?
And I can't find it in the message list of CDialog of MFC too. What should I do?
|
|
|
|
|
May be you have to install latest platform SDK. Ho ever u can send this message just by declaring the below macro in your file.
#define WM_PRINTCLIENT 0x0318
|
|
|
|
|
I can't find any address to download the latest SDK. Could you be kind to give me? Thx!
|
|
|
|
|
|
I know this address. I hadn't find any latest SDK fot MFC on it. So I want to know the detailed address. Thx!
|
|
|
|