|
I used Alt+7 but it did not show the call stack. I tried Alt+F7 also. It also did not work.
This Project is developed using Visual Studio .Net 2003. The editor has a yellow arrow mark. If I click this, the Disassembly window opens. Is this the call stack U mean?
|
|
|
|
|
In my VS version the shortcut is CTRL+ALT+C .
But firsly stop the program in DEBUG mode on a breakpoint.
Russell
|
|
|
|
|
Thanks. It is working(Call Stack Opens). But How to find out at which statement the problem occurs?
There are two markers(One Yellow Arrow and One Green Triangle). What do these markers really mean? Will these markers be helpful in resolving the exception?
The Yellow Arrow stops at this line:
ntdll.dll!7c918fea()
More over, the above said line and following the three lines are gray in color.
The Green Triangle Stops at this line:
msvcr71d.dll!_free_base(void* pblock = 0x00600c08) Line 103 Language C
The above said line is in Normal Color(Black).
|
|
|
|
|
the yellow arrow shows what file/function you are watching in VS, look at that!...and walk forward on the tree to find a function in your code (not in external dll) that do something wrong (than double cliche on that function on the call stack window).
Usually the error is in the first function that you will reach, and usually the real error could be in less than 10 lines before the line related to the crash...but it depends on your code.
Russell
|
|
|
|
|
Thanks a lot.
I clicked all the lines from the beginning of Call Stack. When I Click a New
Line the Green Triangle goes either to a system file(like free.c) or to a inline file(.inl file like nicriticalsection.inl).
ni stands for Net Immerse Game Engine(previously called NetImmerse New Name is Gamebryo).
It did not go to any of the function defined by me. I should not change any ofthese system files or inline files. They are predefined. What to do?
|
|
|
|
|
If ALL the lines (on the call stack window) are external to your project (very strange, becouse this means that your program it is not running ) then you can run the app 'step by step' (F10, or 'step in' F11, in debug mode) the program to find out what function cause the crash.
But I think you have to look better the call stack: 99.9% the error is in your code
Russell
|
|
|
|
|
I tried step by step execution also(by pressing F10). Yellow Arrow moves to some of the system file like free.c,dbgheap.c,stdenv.c,crtlib.c,appui3.cpp and finally to disassembly.
If I continue this step by step execution(F10) from disassembly, once all the
lines are completed the Yellow marker moves to the file where it initially started(i.e this file is also not my file. It is system file only). If I execute step by step(like you said), the window did not open. But usually when run I run the program in debug or release mode, a window will open.
We can do all the operations defined(like loading an image file, moving or rotating an object, setting the visiblity of an object on or off). If I close the window using the cross mark on the top left corner, then only that exception occurs. If terminate the excecution using stop button in the tool bar no exception is thrown.
What to do?
|
|
|
|
|
You need to pause the application one second before the crash...and then use debug tool like F10 or F11 to understand why it crashes. And do this, of course, before that the program exit from your code and goes to external dll(s).
You said that the exception comes when you close the application using the cross on the top right of the window....USE THIS INFO! Go to OnClose() (put there a brakpoint) and run the application step by step F10, F11.
Another thing: pressing the stop button in the VS toolbar will terminate the DEBUG mode, and it destroy the application, so no exception can occuors, beaouse NO CODE will run.
Russell
|
|
|
|
|
Hi
The function prototype of fuctions used in a .c file has to be defined in .c file itself or in .h
Which is the best programming practice?
thanks
Krishnakumar
|
|
|
|
|
It can be defined where, even in a .myhdrfile if you really wanted to do so. The common practice is to put prototypes in .H files. The signature of the function usually has to be encountered, either as a prototype or as the actual implementation, before the function is actually used in code.
Peace!
-=- James Please rate this message - let me know if I helped or not!<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! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
usually prototipe in .h files.
And the real code in .cpp files.
Russell
|
|
|
|
|
Hi,
I added a picture control to my form and choose the BitMap type and loaded a bitmap into that control.
Now I need to draw text over that bitmap.
The problem is that the text is being drawn behind that bitmap and not above it(therefor - I can't see the text).
I use the following peace of code :
HBRUSH Frm_WkAtol::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
CRect rect;
CRgn rgn;
switch(pWnd->GetDlgCtrlID())
{
case IDC_ATOL_CORRIDOR_BITMAP:
{
CRect TextRect;
CDC *pLabelDC = m_AtolCorridorBitmap.GetDC();
m_AtolCorridorBitmap.GetClientRect(&rect);
TextRect = rect;
TextRect.top = rect.top + 10;
TextRect.bottom = TextRect.top + 25;
TextRect.left = rect.left + 25;
TextRect.right = rect.right - 25;
pLabelDC->DrawText(_T("Test") , &TextRect , DT_CENTER);
ReleaseDC(pLabelDC);
}
break;
}
return hbr;
}
Note - if I change the type of the picture control to
a Rectangle,I can see the text.
Doe's it mean that I need to draw the Bitmap by myself???
With best regards,
Eli
|
|
|
|
|
Hi
Just a guess
<br />
CCleintDC dc(this)<br />
CRect TextRect; <br />
m_AtolCorridorBitmap.GetClientRect(&rect);<br />
TextRect = rect;<br />
TextRect.top = rect.top + 10;<br />
TextRect.bottom = TextRect.top + 25;<br />
TextRect.left = rect.left + 25;<br />
TextRect.right = rect.right - 25;<br />
dc.DrawText(_T("Test") , &TextRect , DT_CENTER);<br />
Regards
The Best Religion is Science.
Once you understand it, you will know God.
|
|
|
|
|
OnCtlColor() is called before the control draws itself so if you draw text there it will be
drawn "under" the control, as you are seeing.
You could derive your own picture box class from CStatic and make your m_AtolCorridorBitmap a
variable of that type.
add a WM_PAINT handler to the class. In the OnPaint() implementation, after calling the base
class' OnPaint(), draw your text in the client area of the picture box.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Mark,
Thanks for your detailed explanation.
Mark Salsbery wrote: OnCtlColor() is called before the control draws itself so if you draw text there it will be
drawn "under" the control, as you are seeing.
I didn't knew that.... (do you know where can I find a tutorial about the messages and
windows events sequence?)
Mark Salsbery wrote: You could derive your own picture box class from CStatic and make your m_AtolCorridorBitmap a
variable of that type.
add a WM_PAINT handler to the class. In the OnPaint() implementation, after calling the base
class' OnPaint(), draw your text in the client area of the picture box.
This is just what I'm going to try....
Just one more question:
In design time I can attach a bitmap resource to the picture control.
How can I do it during run time(should I draw the bitmap by myself,or maybe attach
the bitmap in design time and only change the declaration of that control , i.e will it save
the properties I gave it in design time??)
Thanks again,
Eli
|
|
|
|
|
eli15021979 wrote: How can I do it during run time(should I draw the bitmap by myself,or maybe attach
the bitmap in design time and only change the declaration of that control ,
You can use the CStatic::SetBitmap() method to set the control's bitmap.
You'll need the bitmap to set, and how you get that depends on where it is.
If it's a resource, the CBitmap class' CBitmap::LoadBitmap() method or the
Image::LoadFromResource() method will do it.
If it's a JPEG, GIF, BMP, or PNG file, you could use CImage::Load().
eli15021979 wrote: do you know where can I find a tutorial about the messages and
windows events sequence?)
I wish I had specific links but I don't, sorry The book "Programming Windows" by Charles
Petzold is a classic text for Windows fundamentals.
The Platform SDK has details on every Windows message. For example, the WM_CTLCOLORxxx messages
state "is sent to the parent window of a button before drawing the button".
Cheers!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
hye eli,
can u tell me how to insert picture control..........
NT
|
|
|
|
|
You must insert a static control of Toolbox and set bitmap property on the property of control and use of SetBitmap() for insert image file to this control.
|
|
|
|
|
Did you try on the WM_PAINT or WM_ERASEBKGND whats result?
|
|
|
|
|
Hi All
I have a property sheet, with 3-4 Poperty pages in it.
Used CTabCtrl Class to make property sheet...
Now I want to add feature that somone could be able to drag n drop a page from the sheet to the outside window.
Please tell me that how to solve this problem..
Thanks & Regards
|
|
|
|
|
Find a library that implements tear-off pages, or tear-off panes and use it. You can also research implementations of tear-off pages/panes, like at: http://www.codeguru.com/cpp/w-d/docking/openfaq/article.php/c7271/[^].
Peace!
-=- James Please rate this message - let me know if I helped or not!<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! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Hi All
Infact what kind of activity I need is that...
As in Google Talk there is a Buddy List and if click on any of the buddy name then a Chat Dialog is popped up.
Similar kind of work I need in a Tabbed dialog where a dialog contains a CListCtrl and when any item is clicked then a tab (child dialog) is created now what I want is that when click on a list item then a dialog should be popped up and secondly
As told that in my case in the tab control after clicking on the list item a child dialog is created now I want to give the feature that user can drag and drop the child dialog, and the same time both Tab Control and child dialog should be active...
Please reply that how to proceed for this...better if provide some example..
Thanks & Regards
|
|
|
|
|
Similar functionality can be implemented just using non-modal dialogs. When an item is selected you create an instance of your non-modal window. The user will be able to move this window around as necessary.
Peace!
-=- James Please rate this message - let me know if I helped or not!<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! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
I want when I click on a row in a list box all of data in row be bold but only data in first column of row is bold
Agh
|
|
|
|
|
You can do this by using the custome draw( NM_CUSTOMDRAW ) in listcontrol. Search in the CP for custome drawn list controls.
|
|
|
|