|
Dear Friend,
My application works fine in Release mode but it gives an error or displays an abort dialog when I close window in Debug mode.
Please write to me the reason behind this.
Thanking you in advance....
Billar
|
|
|
|
|
maybe it;s giving an assertion error.then is shud give a message like "assertion failed in file so and so in line so and so " .Open up the file and read up that line.Maybe you have done something illegal....
Regards
kane
"Some guys hack just to get themselves a girlfriend.What a pathetic reason, huh? "
|
|
|
|
|
Billar wrote:
Please write to me the reason behind this.
*laughter*
Probably because you have a bug. Without a description of any kind, however, it's quite difficult to know what the problem might be...
|
|
|
|
|
Johan Rosengren wrote:
*laughter*
Probably because you have a bug. Without a description of any kind, however, it's quite difficult to know what the problem might be...
It seems to be a worrying trend that some folks think that just because a program doesn't crash it "works fine". He should consider himself lucky the problem shows itself in a debug build and not just the other way around.;)
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
See if this article helps.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
DEar Friends,
I got the solution. Actually the problem was in the attached lib file. After linking the another or seperate .lib file seperately in Release/Debug mode, problem get solved.
Anyway thanks for your kind co-operation.
Bye
Billar
|
|
|
|
|
dears:
In the following function both Visual C++ 6 and (Insure++ software that detecting memory leaks and bugs) pointing that there are a memory leak in this statement in this function
Since
*CWorkAreaWnd derived from CWnd.
*CDrawObject Derived from CObject and it is the base class for all objects(Shapes here).
* and CDrawObject has m_ObjTracker member function of Type CRectTracker.
code:--------------------------------------------------------------------------------
void CWorkAreaWnd:rawTracker(CDrawObject *pDrawObject , POINT point )
{
/*
** Create Tracker for the selected object.
*/
CPoint n = point ;
CDrawEditor32App * pApp = (CDrawEditor32App*)AfxGetApp();
CDrawEditor32Doc *pDoc = pView->GetDocument();
CRect rect ,objectRect = pDrawObject->getObjectRect();
if (pDrawObject->m_ObjTracker)
{
pDrawObject->m_ObjTracker = NULL;
delete pDrawObject->m_ObjTracker;
}
//////////////////////////////////////////////////////////////////////////////////
pDrawObject->m_ObjTracker = (CTrackerObj *)new CTrackerObj(objectRect,CRectTracker::dottedLine |CRectTracker::resizeInside |CRectTracker::resizeOutside );
//Here compiler and Insure indicate memory leak
/////////////////////////////////////////////////////////////////////////////////
if ((pDrawObject->m_ObjTracker))
{
if(!bArrowKey && !pDoc->pDrawClass->bMultiSelection)
pDrawObject->m_ObjTracker->Track(this, point, TRUE );
else
pDoc->m_Change = TRUE;
pDrawObject->m_ObjTracker->m_rect.NormalizeRect();
CRect TakerRect = pDrawObject->m_ObjTracker->m_rect;
if(!objectRect.EqualRect(TakerRect))
{
rect = pDrawObject->CalculateDimensionRect(TakerRect);
pDrawObject->setObjectRect(rect);
}
}
}
--------------------------------------------------------------------------------
but the problem if i add this at the end of the Fucntion
-------------------------------------------------------
code:
delete pDrawObject->m_ObjTracker;
-------------------------------------------------------------
the program will crash when draw something in screen .
where is the right place to perform free memory in this case?
and why crashing occured since i free memory before the scope of the fucntion end up.
Thanks
|
|
|
|
|
You might get the crash if you don't set pDrawObject->m_ObjTracker to NULL at the end. You will most probably have forgotten to add a delete in the destructor as well
You can, however, make the DrawObject class manage its own memory. Add a function CreateTracker instead of allocating memory in the calling function. In CreateTracker, delete the old tracker if it exists and create a new one with new . Make sure to delete the tracker in the DrawObject destructor.
You are making a maintenance nightmare for yourself by allocating part of a class outside the class, naughty, naughty, naughty *slap on wrist*
|
|
|
|
|
dear:
I got ur point and u r completely right, it is a big nightmare to locate var in calling fucntion, I'm changing the code as u said.
Thanks
|
|
|
|
|
Anyone know how to write a getProcessor ID and getProcessor String?
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
Take a look at this
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Great answer that you very much1
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
Hi, I have created a simple tetris game for a school project alogn with some firends. I currently am having a dilema. I have two problems. One has to do with the topic of this message; I am trying to write the score of the game when ever the score of the current game is higher than the score in the file. So if I played and got 1000 points then died it woudl write 1000 to a file (points.txt), and if you played after and got over 1000 it would override my score with yours, but if you got less it wouldnt... Afterwards I want to read the file and output the score within on the score as "highscore: ___". So how do I do this? Source require please... visual is new to me...I'm used to dev c++. I am lookign for a simple way of reading and writing (like adding a .h and calling on one of its functions to read or write). I know abotu fstream but I cant seem to get it to work..
P.S) the second this I was having problems with is I am lookign for a pause function....but that can wait.
Thanks in advanced
Glen Buchholz
|
|
|
|
|
>> I know abotu fstream but I cant seem to get it to work..
Your in a school C++ course and no one can show you how to get fstream working? What school is it?
unsigned long score = 0L;
std::ofstream os("sample.txt");
score = 1000;
os << score;
os.close();
std::ifstream is("sample.txt");
is >> score;
is.close();
>. I am lookign for a pause function
::Sleep( 5000); // sleep for 5 seconds
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Thanx, so much.
Got it working perfectly
P.S) Its a high school and we do things in Dev C++... which we had fstream workign in...vc++ is a bit different...
|
|
|
|
|
All resources of my application is designed in 1024 * 768 pixels resolution ,
after changing the resolution in to standard 800 * 600, some of the screen is beyond the visible area. i want to change my application in a manner that that must work in any resolution ( i found some applications do this very nicely ).
is there any code to do this?
and one more thing, how can i get the current resolution of screen and how can i change that by code?
Thankyou
I want to change Myself..Can u help me?
|
|
|
|
|
Well the main stream approach to building desktop applications is to use windowing techniques to avoid any specific screen resolution dependencies. If I ever installed a desktop application that changed my screen resolution on me I would get rid of it faster than you can say “bite me”.
With that said here is a controversial article to that end:
http://www.codeproject.com/gdi/screenresolution.asp[^]
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
i want an API/code for changing to any resolution that supported by my graphics card.
thank you.
I want to change Myself..Can u help me?
|
|
|
|
|
ChangeDisplaySettings is what you want.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Just a guess, but I would figure you'd find the screen dimensions inside GetSystemMetrics
How do I print my voice mail?
|
|
|
|
|
Hey All,
I am having a small problem setting the focus to a control on a property page in my OnInitDialog() function.
BOOL CPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
<snip>
if (some_condition)
{
m_Edit.SetReadOnly();
m_ComboBox.SetFocus();
}
else
m_Edit.SetFocus();
return FALSE;
}
It does not matter if some_condition is TRUE or FALSE, the m_Edit control always has the input focus. m_Edit is the first control in the tab order. Does returning FALSE from OnInitDialog() not work for property pages, or am I missing something?
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
For a CPropertyPage -derived class, you need to use the OnSetActive() method instead.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Ok, I am starting to feel like a complete idiot. I still can't get this to work.
BOOL CPage::OnSetActive()
{
BOOL ret = CPropertyPage::OnSetActive();
if (some_condition)
m_Combo.SetFocus();
return ret;
}
m_Combo.SetFocus is called successfully, but the focus remains on the edit control when the page finally shows.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
How about:
#define MSG_SETFOCUS WM_APP+1
BOOL CPage::OnSetActive()
{
BOOL ret = CPropertyPage::OnSetActive();
if (some_condition)
PostMessage(MSG_SETFOCUS);
return ret;
}
LRESULT CPage::MySetFocus( WPARAM, LPARAM )
{
m_Combo.SetFocus();
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
That definitely works, thanks. I will use that hack for now.
But is it really necessary to go through that that type of hack to set the focus to a control? There is obviously something that I am missing.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|