|
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
|
|
|
|
|
I want to capture the image on the screen which is a custom control. I am not able to capture it with WM_PRINT. BitBlt is failing since the target window is invisible. (refer the site http://www.gamedev.net/community/forums/topic.asp?topic_id=327506[^]
And the code that i have shown like attach is not in the OnPaint(). It is in my own function.
Regards, Eswari
|
|
|
|
|
Naveen wrote: Sorry, I coudn't understand the diifference...What do you mean by "content of the contol" and "screen shot of the control".
The difference is having Notepad running with a large text file and doing a screen-shot using <alt+printscrn></alt+printscrn> as opposed to using File-Print .
The first one gets you the "screen shot of the control" (plus the application window itself), the other gets you the "content of the control."
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
I don't know how to attach files. So that you can see the difference
Regards
|
|
|
|
|
Hi all,
I m working on VC++ 2005 MFC application,
here i m using a DateTimeControl.
Please tell me how can get the Moth and year value from the selected date of DateTimeCtrl.
Please help me for this.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|