|
The compiler allocates an area of code/data space with the string in it and sets *arr to point to it. Because its allocated by the compiler, it cannot be deleted (its not dynamic). You would get some kind of assertion error in debug and probably a crash in release.
Best thing to do.
Nothing.
Its not a leak.
Roger Allen - Sonork 100.10016
Strong Sad: I am sad I am flying
Who is your favorite Strong?
|
|
|
|
|
delete[] will call the right destructor for each cell member before destroying the tab itself. prefer it if you have to, but otherwise, it is destroyed automatically by the system at the end of its code block...
TOXCCT >>> GEII power
|
|
|
|
|
delete is for new
delete[] is for new[]
free is for malloc, calloc realloc
Nothing otherwise
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
|
loveablevirus wrote:
So your code,
char* arr = “Nisse”;
may work right at most times... but will make problem at some times.
The code is perfectly legal and will work at all times. "Nisse" will be allocated by the compiler in the global memory segment as a char[6] (null-terminated). arr is a stack variable which is pointing to this global memory. All is safe -- as long as you treat it as a char[6].
And since you have not allocated the memory (with new) you should not do a delete.
|
|
|
|
|
Whar are the other softwares/dependancies that are downloaded when I install Internet Explorer.
One of them will be JVM.
In order to which site can give me any information on this.
Kindly let meknow.
|
|
|
|
|
hi all
Is it possible to make a control which is inside dialog fullscreen ? Not whole dialog only selected control .
Bilge Kaan
|
|
|
|
|
No. The control will be clipped by the dialog. You can set it to whatever size you like, but only the part inside the dialog will be visible.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
HI
How can i make ComboBox readable only ...
no one can enter value in it.
thanx
|
|
|
|
|
by setting its type property to Drop List
TOXCCT >>> GEII power
|
|
|
|
|
Dear Fiends,
I got a child dialog box. Problem is that on pressing the enter key the dialog disappears. What i want is that on pressing the enter key, some button on the dialog gets pressed. How can i do so.
Imtiaz
|
|
|
|
|
override your OnOK and OnCancel of your Dialog. And comment out the
CDialog::OnOK() or CDialog::OnCancel()
Just check Michael Dunn FAQ article for detail.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
Make the button Default from the prorpties of whhich u want the functionalty as a defualt on pressing first time ENter key..
may be it works..
|
|
|
|
|
Override OnOK() .
CMyDialog::OnOK()
{
PostMessage (WM_COMMAND, IDC_SOME_BUTTON);
} /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Create two member functions for you dlg class.
Eg.
void CTestDlg::OnOK()
{
}
void CTestDlg::OnCancel()
{
}
Enough... Go and press any key in ur dialog... it wont close (even ur close button too;))
To close ur dialog Add OnClose() Message Handler to your dlg class
void CTestDlg::OnClose()
{
EndDialog(0);
CDialog::OnClose();
}
now press you close button. It will close
Hava nice day
with regards
loveablevirus
modified on Saturday, January 17, 2009 9:27 AM
|
|
|
|
|
Fiends,
I got a child dialog box. Problem is that on pressing the enter key the dialog disappears. What i want is that on pressing the enter key, some button on the dialog gets pressed. How can i do so.
Imtiaz
|
|
|
|
|
well you could set the focus on that button, when pressing enter that will activate it.
Other way is capturing the WM_KEYDOWN message in pretranslate func and check wParam for VK_RETURN.
Hope this helps you...
Regards,
Davy
|
|
|
|
|
Cwnd::SetFocus ();
if you use this into OnInitDialog (), you should switch its return value to FALSE .
TOXCCT >>> GEII power
|
|
|
|
|
HI,
How can i set timer Event to a dialog...
means how can i creat it, set it , kill it ,
any code
plz thanx
|
|
|
|
|
|
If is it mfc application , u can use this
BOOL CTelnetServerDlg::OnInitDialog()
{
… … …
… … …
… … …
SetTimer(100,20000,NULL);
… … …
… … …
… … …
}
BEGIN_MESSAGE_MAP(CTelnetServerDlg, CDialog)
//{{AFX_MSG_MAP(CTelnetServerDlg)
… … …
… … …
… … …
ON_WM_TIMER()
ON_WM_DESTROY()
… … …
… … …
… … …
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CTelnetServerDlg::OnTimer(UINT nIDEvent)
{
if (nIDEvent == 100)
{
// TODO: Add your message handler code here and/or call default
}
CDialog::OnTimer(nIDEvent);
}
void CTelnetServerDlg::OnDestroy()
{
KillTimer(100);
CDialog::OnDestroy();
}
|
|
|
|
|
Hey,
I have a couple of combo boxes, and When they hit new in the menu, I want it to clear, but when I use the m_varible.clear() command, it only clears the one I have highlighted or the last one I selected.
How do I get it to clear all of them?
Here is the code:
<br />
void CDEPDlg::OnFileNew() <br />
{<br />
m_type1.Clear();<br />
m_type2.Clear();<br />
m_type3.Clear();<br />
m_type4.Clear();<br />
m_type5.Clear();<br />
}<br />
<br />
Thanks for any help
|
|
|
|
|
Try this
extern CComboBox* pmyComboBox;
for (int i=0;i < pmyComboBox->GetCount();i++)
{
pmyComboBox->DeleteString( i );
}
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
Hi,
try this
<br />
MyCombo.ResetContent(); <br />
<br />
SendMessage(MyComboHwnd, CB_RESETCONTENT, 0, 0);<br />
HTH
Frank
|
|
|
|
|
Thanks guys that worked.
How about an editbox, that is ready only, and it displays the text of a combo box, I tried the clear() function there too, but it doesn't work.
Any ideas?
Thanks
|
|
|
|