|
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.
|
|
|
|
|
If you mean full row selection;
DWORD dwExtStyle = m_listCtrl.GetExtendedStyle();
m_listCtrl.SetExtendedStyle(dwExtStyle | LVS_EX_FULLROWSELECT);
--
=====
Arman
|
|
|
|
|
Hi all,
I have a program that does all kinds of graphical stuff. It calls classes from classes, etc. On the deepest level, something may change which requires the mainroutine to redraw the image. Currently, I pass all these classes a pointer to the parent class, and call "m_Parent->SendMessage (XL_REDRAW)". In the main class, I catch this message and perform the necessary drawing actions. However, this causes the program to crash in the release version. Everything goes well in the debug version however.
Please note that the subclasses are no windows in their own right, but are basically just called from the parent class and may in turn again call sub classes themselves.
Anyone any idea why this approach does not work? (and of course most of all: how to solve this)
Thanks in advance
William
|
|
|
|
|
If multi threading is involved then remember that SendMessage halts the caller until the message is processed and it returns. In this scenario PostMessage is your friend.
Either way you'd probably be better off doing an Invalidate or InvalidateRect when the message is sent rather than trying to draw directly. This will cause Windows to send you WM_PAINT messages at its convenience which generally works a lot better. If Debug builds work and Release builds don't then it's usually a timing or memory overrun problem. This one looks more like timing/synchronisation but I couldn't be sure wihtout the code
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
If you are using VS6.0 with MFC, there may be a problem with how your message handlers are written. The version of MFC that ships with 6.0 is very tolerant of mismatched signatures with the message handlers.
For example, when you create an ON_MESSAGE handler, the function used with it is supposed to have a signature of LRESULT func( WPARAM, LPARAM ) , but if you created the function as void func( WPARAM, LPARAM ) , it would/may still compile and run correctly in debug, but would crash quickly in release.
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,
I have written my MFC application and I have list of dependency dll's for my application. I have written my application in VS2005. To run my application in test PC wht are the default dependency files required.
can anyone plz help me
Rgds
Trinadh
|
|
|
|