|
Technically, it's a memory leak. Practically, it isn't. All memory allocated on the heap in a process is automatically returned when the process is terminated.
A "real" memory leak's characteristics is one that grows with time, which will eventually starve the system of free memory. Assuming of course that the memory allocated isn't used after a certain point. If the app really uses and needs the memory, it doesn't qualify as a memory leak. It could mean that the application is poorly designed.
If you for instance make one allocation in the application, and you don't free it, it's not a memory leak. If you continously make memory allocations in the application, without freeing them when you no longer require the memory, then you've got yourself a very real memory leak.
--
For proper viewing, take red pill now
|
|
|
|
|
Hi Jörgen,
Thanx for your reply, I want to know if the memories are reclamied or not, while the application quits.
Your post helped me lot.
Thanx once again..
Do your Duty and Don't expect the Result
|
|
|
|
|
Hi all,
Can u please tell me how to update an edit-box field present in a model-dialog from another class
I have used
CUsatDlg *dlg= new CUsatDlg;
HWND hdlg =dlg->m_hWnd;
SetDlgItemText(hdlg,IDC_SERIALNO,"Serial");
UpdateWindow(hdlg);
Where CUsatDlg is mu dialog box class ,and IDC_SERIALNO is my edit box field
But the edit-box is not displaying the text
|
|
|
|
|
Veeresh Hiremath wrote: edit-box field present in a model-dialog from another class
You need to pass a pointer of the class (where the edit box is contained) to another class. Using that pointer you can access the variables in another class.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_
I am newbie to vc++/mfc.
Can u please send me a skeleton code
|
|
|
|
|
Veeresh Hiremath wrote:
Can u please send me a skeleton code
Here is a sample code. You access the function of class B from class A. On similar lines you can also use the variables etc.
#include <iostream>
using namespace std;
class B
{
public:
B()
{
cout<<"Constructor of B\n";
}
void Display()
{
cout<<"In Function Display of B\n";
}
};
class A
{
public:
B b;
A()
{
cout<<"Constructor of A\n";
}
void CallBClassFn()
{
b.Display();
}
};
int _tmain(int argc, _TCHAR* argv[])
{
A a;
a.CallBClassFn ();
return 0;
}
I hope this helps in solving out your problem...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
if your main class is Main and another class in Local you can use this code on Local class
<br />
CMain *m_Main=(CMain*)GetParent();<br />
m_Main->functions or variables<br />
|
|
|
|
|
Simply post a message to the window (e.g., dialog) that owns the edit control.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Veeresh Hiremath wrote: CUsatDlg *dlg= new CUsatDlg;
HWND hdlg =dlg->m_hWnd;
you need the actual Window Handle of displayed window.. this willnot help..
either have a pointer to that class. or make some global variable!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And you
|
|
|
|
|
Hi Friends
MessageBox is not displayed in ExitInstance function in MFC Dialogbased Application ?
thanx in advance
KK
|
|
|
|
|
this is because WM_QUIT message lies in the message queue.
try the below code. It just remove the WM_QUIT message.
MSG stMsg= {0};
while( ::GetMessage( &stMsg,0,0,0))
{
}
AfxMessageBox( L"hi" );
nave
|
|
|
|
|
Hi Naveen
Sometimes application still resident in memory (Not quiting well)
thanks in advance
KK
|
|
|
|
|
put PostQuitMessage(0); after the message box and try
nave
|
|
|
|
|
Hi Naveen
Thanks for your valuable information
This is Krishna Kumar
KK
|
|
|
|
|
kk.in wrote: This is Krishna Kumar
have we met?
nave
|
|
|
|
|
Naveen R wrote: have we met?
hai Naveen
you find friend here
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And you
|
|
|
|
|
I am very happy to find friends from here. I already know two krishnakumar's. So I just want to know whether he is any one of them?
nave
|
|
|
|
|
Naveen R wrote: I am very happy to find friends from here. I already know two krishnakumar's.
he he he .. good!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
No, But i heard about u from Nishad
KK
|
|
|
|
|
hooo.
He told me about u when I show ur post to him. But he was not sure.
I suggest u not to show the message in the Existinstance. If ur application is a dialog based one, Show the message box in the Initinstance after the DoModal() call to the dialog.
nave
|
|
|
|
|
well Where r u from? Working in which company?
nave
|
|
|
|
|
Naveen R wrote: try the below code. It just remove the WM_QUIT message.
is there any relation between ExitInstance and WM_QUIT message!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And you
|
|
|
|
|
When I saw his question, I started investigating the problem. I tried calling DoModal for a dialog. Inside the DoModal function i found that the message loop returned immediately.this was because it had a WM_QUIT message in the message queue. I think the WM_QUIT message that gets posted when we close a dialog resides in the queue.
nave
|
|
|
|
|
See if MSDN article Q138681 is of any help.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
MFC Dialog Based Applications generally act up in the following way:
1) Initialize MFC
2) Call InitInstance. Create and show the dialog box here, if it's a modal dialog box application
3) The dialog box terminates
4) InitInstance returns FALSE.
5) Call ExitInstance.
6) Terminate.
When a Dialog Box application's ExitInstance is running, the application's message pump is shut down already, and the application is preparing to terminate. Calling MessageBox will order the box to be a child of the desktop window, and will freeze the desktop while the box is being shown. This is generally a bad idea, since your application is outrightly blocking the desktop for the sake of displaying it's own message.
Put the MessageBox call to somewhere else. Anywhere but ExitInstance should do quite fine.. Perhaps right after the dialog terminates in InitInstance, but before InitInstance returns FALSE ?
- Antti Keskinen
----------------------------------------------
"If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?"
-- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.
|
|
|
|