|
Hello,
I have selected my button style to be 'Flat'. I do not want the borders around it. Is there a way to do that?
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
you may need to make owner drawn button.
|
|
|
|
|
Do you have derived CButton and if yes do you use from WM_DRAWITEM in your code
|
|
|
|
|
I got the idea what should be done.
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
|
hi all,
in main class i created some class objects using NEW operator and in destructor i used delete operator to delete that created objects
but its not entering into destructor when i exit my application
plz help in this issue
Thank you
venu
|
|
|
|
|
g venu wrote: in main class i created some class objects using NEW operator and in destructor i used delete operator to delete that created objects
When you "new" an object the constructor for the corresponding object gets called and when you "delete" an object the destructor for that object get's called.
But you are saying it doesn't enter the destructor for the corresponding objects when you exit the application. The destructor get's called when you delete the object. Only objects created on stack get's destroyed automatically, the rest should be deleted.
|
|
|
|
|
Post some code, it's much more clear than an explanation. As I understand, you allocate some objects with new:
MyClass* pClass = new MyClass;
And you try to delete the memory inside the destructor ?
MyClass::~MyClass
{
delete this;
}
This will never work. When you create a class with new, its destructor will be called only when you delete the object. You must delete the object outside the destructor.
|
|
|
|
|
i created objects like this and
void mymainDlg::CreateTabWindows()
{
m_phoneDlg = new CGlobe7Phone();
m_phoneDlg->Create(IDD_PHONE,this);
m_TelevisionDlg = new CGlobe7Television();
m_TelevisionDlg->Create(IDD_DIALOG_INTERNET_TELEVISION,this);
m_MessageCenterDlg = new CGlobe7MessageCenter();
m_MessageCenterDlg->Create(IDD_DIALOG_MESSAGECENTER,this);
}
i used destructor like this but it does'nt work and showing memory leaks
mymainDlg::~mymainDlg()
{
delete m_phoneDlg;
delete m_TelevisionDlg;
delete m_MessageCenterDlg;
}
Thank you
venu
|
|
|
|
|
Looks alright to me. Try placing breakpoints in the destructor. The memory leak could be from any of your created dialogs too. Check that any allocated memory in those dialogs is freed when it is destroyed.
|
|
|
|
|
how mymainDlg object is created ? If its created using new, have you deleted it? You need to show that code.
|
|
|
|
|
yes i agree with Weiye Chen The memory leak could be from any of your created dialogs
Are you sure your error is in destructor
|
|
|
|
|
hi prasad,
mymainDlg is created in mymainApp class, i think its not necessary to delete in destructor ?
Thank you
venu
|
|
|
|
|
hi,
you are right ? memeory leaks are shown when my dialogs are created
i,e: in this function
void mymainDlg::CreateTabWindows()
{
m_phoneDlg = new CGlobe7Phone();
m_phoneDlg->Create(IDD_PHONE,this);
m_TelevisionDlg = new CGlobe7Television();
m_TelevisionDlg->Create(IDD_DIALOG_INTERNET_TELEVISION,this);
m_MessageCenterDlg = new CGlobe7MessageCenter();
m_MessageCenterDlg->Create(IDD_DIALOG_MESSAGECENTER,this);
}
but what's wrong in this ??
will u plz tell me
thank you
venu
|
|
|
|
|
hi,
its working when i created separte function
in that function i deleted all the objects which i created
like OnExit Function where my application exits
Thank you all
venu
|
|
|
|
|
g venu wrote: i think its not necessary to delete in destructor
If its created on stack , its d'tor will automatically get called.
But if its created using new, you must use delete.
Can you show code, where main dialog constucted, shown?
|
|
|
|
|
hi prasad,
BOOL mymainApp::InitInstance()
{
// InitCommonControls() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
InitCommonControls();
CWinApp::InitInstance();
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need
// Change the registry key under which our settings are stored
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
mymainDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
here is for main dialog which is created
Thank you
venu
|
|
|
|
|
its look perfect to me,too. For just a try,
try creating mymainDlg object on heap, i.e.
code will look like this,
mymainDlg* dlg=new mymainDlg;
m_pMainWnd = dlg;
int nResponse = dlg->DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
delete dlg;
|
|
|
|
|
Another thing you need to take note is that if you call more than 1 time, you will create memory leaks because you didn't check if there's any memory previously allocated to those pointer variables.
|
|
|
|
|
Hi all,
I made an Application in VC++ , as usual it includes StdAfx.h and StdAfx.cpp files .
What I need to do is to eliminate only "StdAfx.cpp" file from my Application.
How can in Achieve it.
Thanks in Advance.
George K Jolly
-- modified at 2:20 Wednesday 16th August, 2006
|
|
|
|
|
georgekjolly wrote: I made an Application in VC++ , as usual it includes StdAfx.h and StdAfx.cpp files .
What I need to do is to eliminate only "StdAfx.cpp" file from my Application.
The main purpose of StdAfx.cpp file is to get the contents of StdAfx.h file compiled, since .h file cannot be compiled. This is done for generating a pch ( PreCompiled Header ) file.
You can disable the use of precompiled files by going to Project Settings --> C/C++ --> PreCompiled Headers --> Not Using Precompiled headers.
As far as your question is considered you can delete StfAfx.cpp but this breaks the purpose of the file.
|
|
|
|
|
Hi Nibu,
ThankYou Very much for ur Answer
George K Jolly
|
|
|
|
|
Press "Enter" key and "ESC" key would dismiss a MFC modal dialog. These two key down events cannot not be directly captured and processed by the modal Dialog as the dialog will be immediately dismissed when user press the two keys.
Is there any way to avoid this happening? Is there any way to modify this behaviour of MFC model dialog?
![Confused | :confused:](https://www.codeproject.com/script/Forums/Images/smiley_confused.gif)
|
|
|
|
|
|
Hi, Mike. Did you get my email ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|