|
Sometime I am getting the error message saying:
"Unhandled exception at 0x00000000 in MyApplication.exe: 0xC0000005: Access violation reading location 0x00000000." but it is not pointing to the source code line caused this violation.
If I break, callstack is pointing "00000000()".
In this case is there any setting in VC++ to detect the line which caused exception.
Otherwise I will debug manually to find out the place..
Regards,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
If you start your debugger, it should bring you to the problem (or to assembly code if no source can be found). From there, use the call stack to come back into your own code.
|
|
|
|
|
Hi Cedric Moonen,
Thanks for your help!!
Sorry I modified the question, I am using debugger but callstack not showing source line.
Disassembly is showing address 00000000 and there are only question marks "????".
Thanks,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
How does your call stack look like. It seems that you are confusing call stack with something else... The call stack shows all the functions that have been called to reach the current point in the code. By walking the callstack, you can 'travel' back to where the problem is coming from.
For VC2005: "Debug" menu -> "Windows" -> "Call stack" (or Alt + 7) will display the call stack window if you are in debug mode and on a breakpoint.
|
|
|
|
|
I used to look at callstack to trace the error always, but some cases like this, callstack is not showing any function but the arrow pointing to "00000000()" in callstack.
I think it means something out of callstack scope, or we have change some setting to break and show this exception in callstack
Regards,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
The error is making your call stack unreadable, so you need a different method to find the error. Use breakpoints to find the last statement executed before the error occurs. I'm predicting you're trying to use a NULL pointer.
|
|
|
|
|
In the Debug Menu
Exceptions
do modification to some setting over there...
|
|
|
|
|
I am using WM_PRINT to print the control. But it is copying the content of the control not the screen shot of the control. I tried to use PrintWindow. But as i am working on VC6.0, not able to use.
Any help is appreciated.
|
|
|
|
|
subramanyeswari wrote: But it is copying the content of the control not the screen shot of the control.
Sorry, I coudn't understand the diifference...What do you mean by "content of the contol" and "screen shot of the control".
subramanyeswari wrote: I tried to use PrintWindow. But as i am working on VC6.0, not able to use.
In VC6 also you can use this function. For this either you have to import this function dynamically or you should install latest platform SDK( it is free ).
|
|
|
|
|
I have a grid in the control. It is capturing the data in the grid but it is not capturing the grid. I mean the grid is not displayed.
Regards
|
|
|
|
|
So how did you draw your grid and data( data means text, right? ). In OnPaint() ?
|
|
|
|
|
my main(CAlarmObject) class is derived from CObject. i have a class (CWiZListCTRL)and that is derived from CListCtrl. and drawing is taken place in the OnPaint of CWiZListCTRL. and i am calling that in my main(CAlarmObject) draw method
Regards
|
|
|
|
|
subramanyeswari wrote: and i am calling that in my main(CAlarmObject) draw method
can you paste the code of OnPaint() here. Also you should never call the onpain() function directly.
|
|
|
|
|
No ..i am not calling onpaint. i am calling updatewindow, which is issuing OnPaint() command.
modified on Friday, June 27, 2008 3:05 AM
|
|
|
|
|
Is CMemDC your class? In the baove code, I coudnt find the you bitblt the content of memorydc back to the paint dc. Is it performed in the destructor of the CMemDC?.
Also why are you using a Memeory dc here? Is there any problem is you directly use the CPaintDC object?
|
|
|
|
|
Yes you are right CMemDC is our class. Here BitBlt fails because it is not one of active screen. Actual draw method is this
CWnd InTouch;
InTouch.Attach(m_hWndParent);
m_Parent.AttachExternalObject(this);
DWORD dwStyle = WS_CHILD |WS_VISIBLE;
VERIFY(m_Parent.Create(NULL, "Invisible", dwStyle, DrawRect, &InTouch, 0));
SetDrawMode (DRAWMODE_DESIGNTIME);
Draw(&InTouch, DrawRect);
where m_Parent is a member of one of our class CInvisibleParent. before calling the actual drawing of the user control we are creating m_Parent by attaching InTouch. So BitBlt is failing.
|
|
|
|
|
but what is the relation between this code and onpaint() function? The bitblat need be done to the CPaintDC object( the object your apssing to the CMemDC constructor ).
|
|
|
|
|
Naveen,
I tried BitBlt in the onpaint. What it returns is a blank page. here is my code.
HDC hdc = ::GetDC(this->m_hWnd);
HDC memDC = ::CreateCompatibleDC(hdc);
int w = rectTemp.right-rectTemp.left;
int h = rectTemp.bottom-rectTemp.top;
HBITMAP bitmap = ::CreateCompatibleBitmap(hdc,w,h);
::SelectObject(memDC,bitmap);
BOOL bRet = ::BitBlt(memDC, 0, 0, w, h , hdc, rectTemp.left, rectTemp.top , SRCCOPY );
Regards
|
|
|
|
|
no no whet i mean is to the following line in the end of the OnPaint() function.
dc.BitBlt( 0, 0, rect.Width(), rect.Height() , hdc, 0, 0 , SRCCOPY );
|
|
|
|
|
it didn't work. same result. it resulted into a blank page
|
|
|
|
|
yesterday I told you to check another thing, Using the CPainDC object directly. Now you are creating the CMemDC in between. Remove it and do all the painting and SendMessage directly on CPaintDC object.
|
|
|
|
|
Ok. I will try. One more question. with WM_PRINT i am able to capture the content of the grid. But not able to print the grid. Is it not possible to print the grid with WM_PRINT?
Regards
|
|
|
|
|
ops. there is a pblm. I tried like
void ListEx::OnPaint()
{
CPaintDC dc(this);
SendMessage(WM_PRINTCLIENT, (WPARAM)dc.m_hDC, (LPARAM) PRF_CLIENT);
}
In the above code, the grid is also painting. then I tried to paint it to the desktop like
void ListEx::OnPaint()
{
CListCtrl::OnPaint()
CWindowDC dc2(0);
SendMessage(WM_PRINTCLIENT, (WPARAM)dc2.m_hDC, (LPARAM) PRF_CLIENT);
}
But in this case only the text came...
|
|
|
|
|
First let me thank you for your kind support.
I wrote the code like this it is printing but no grid line not the entire client screen. it is capturing the area where the data is there
So what should i do
<div class="ForumMod">modified on Friday, June 27, 2008 3:07 AM</div>
|
|
|
|
|
subramanyeswari wrote: memDC.Attach(hDC);
why is this attach? And is this all code in the paint function? Because, the CPainDC should be used only in the OnPaint() function.
Actaully what is your purpose? To customise the list control, there are another standard method likes, Custom Draw( NM_CUSTOMDRAW ) and Owner draw . It better to use those functions for customizing especially using Custom Draw is simple and you can find many samples in code project itself.
Good Luck
|
|
|
|