|
George_George wrote: 1. if the _buf is binded to a local variable (e.g. a local string variable), then if instance of Foo lives longer than the local variable, is it safe?
2. if the _buf is binded to a heap variable, and it is released some time but Foo does not the release operation, then using _buf is not safe?
I don't see your concerns are related to reference in anyways.
Both can cause problem even if you do not use reference.
Regards,
Sandip.
|
|
|
|
|
SandipG wrote: George_George wrote:
1. if the _buf is binded to a local variable (e.g. a local string variable), then if instance of Foo lives longer than the local variable, is it safe?
2. if the _buf is binded to a heap variable, and it is released some time but Foo does not the release operation, then using _buf is not safe?
I don't see your concerns are related to reference in anyways.
Both can cause problem even if you do not use reference.
How about making a local copy of the original object?
The concerns are related to accessing the same instance using the address of the instance whereas the use of pointers is one way and references is another.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanks Roger,
So, you agree with the two issues I pointed out?
regards,
George
|
|
|
|
|
Why Sandip?
SandipG wrote: I don't see your concerns are related to reference in anyways.
Reference member variable binded to local variable or binded to "deleted" variable is not an issue?
regards,
George
|
|
|
|
|
No i mean is it is not a issue of a reference variable.
Consider instead of reference you have a pointer.
It will still be a dangling pointer right??
What i want to say is its a common problem. It does not arise because you use reference variable.
Don't you agree??
Yes with reference you feel it is issue because you cant reinitialize the reference.
And if if the object is going to be deleted in between then there is no use of using it as a reference. instead you can use pointer so you can reinitialize to NULL or some other valid object.
Regards,
Sandip.
|
|
|
|
|
I agree with all of your comments, Sandip!
regards,
George
|
|
|
|
|
how to display text to edit boxes like printf in c while the program is running.
if i have some code in c like
{
printf("hello");
//do some computations for some time and then
printf("%d",result);
}
thanks & regards
|
|
|
|
|
you have to call SetWindowText() on your edit box instance.
but maybe you should start learning MFC/Win32 because that's a really very simple task.
|
|
|
|
|
you can use SetWindowText to set the text in the edit box. if you want all of the text to appear, as it does in the console window you can set the multiline property and the want return property to true.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Use sprintf() (documentation here) to copy the formatted data into a string then use SetWindowText() (documentation here) to put this text into the edit control.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
And what is your problem about?
You may (Win32 ):
(1) format a string using sprintf
(2) send the string to the edit box using SetWindowText .
On the other hand, using MFC you may:
(1) map a CString variable to the CEdit control.
(2) use the CString::Format method to properly format such variable.
(3) call CDialog::UpdateData(FALSE) of your dialog.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i am writing in vc++6 as below
CString s;
s="hello \r\n";
m_ed3.SetWindowText(s);
s+="hello1 \r\n";
m_ed3.SetWindowText(s);
Sleep(5000);
s+="h\r\n";
m_ed3.SetWindowText(s);
and i want to display first
hello
hello1
wait for 5 sec and display
h
but i am getting all the three at a time
thanks & regards
|
|
|
|
|
CString s;
s="hello \r\n";
m_ed3.SetWindowText(s);
m_ed3.RedrawWindow();
Sleep(5000);
s+="hello1 \r\n";
m_ed3.SetWindowText(s);
Sleep(5000);
m_ed3.RedrawWindow();
s+="h\r\n";
m_ed3.SetWindowText(s);
m_ed3.RedrawWindow();
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
thanks a lot, it's working
thanks,
|
|
|
|
|
Hi,
I am using task pane in my application. i want to show my own items in the context menu, when i right click on task pane . currently it showing 5 subitems "Floating,Docking,etc.."
i want to remove that items and add my own items in the context menu.
please help me..
|
|
|
|
|
What is static library and Dynamic Library? What is the difference?
Warm Regards
Jagadish.K.R
|
|
|
|
|
j_j_j wrote: What is static library and Dynamic Library? What is the difference?Confused
Just googled![^]
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
|
hi, i have a dll. This dll was be patched a exe. This dll send a code to exe . i wanna change this code . How can i do that ???
DLL Link : http://www.n-protect.com/protect.dll
regards.
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
nedracix wrote: This dll was be patched a exe. This dll send a code to exe .
Incomprehensible. Please refactor.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Do you want to hack dll ?
|
|
|
|
|
Hai!
I am creating an XYZ.txt file in my project,
i want that each time the XYZ.txt is created the name must be not simple as XYZ.txt, but it must be XYZ_DATE_TIME.txt
XYZ_27-08-2008_02-12.txt
XYZ_27-08-2008_16-45.txt
|
|
|
|
|
See SYSTEMTIME and GetSystemTime/GetLocalTime to get the time information for a system.
Later you can format the string to your needs using CString::Format()
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
kapardhi wrote: I am creating an XYZ.txt file in my project,
i want that each time the XYZ.txt is created the name must be not simple as XYZ.txt, but it must be XYZ_DATE_TIME.txt
XYZ_27-08-2008_02-12.txt
XYZ_27-08-2008_16-45.txt
You can use functions _strdate_s and _strtime_s for getting time and date as string...
Quickly typed in a function which does this...
CString CreateFileNameWithTimeStamp( LPCTSTR lpctszTitle, LPCTSTR lpctszExtension )
{
CString csFileNameWithTimeStamp = lpctszTitle;
const int BuffSize = 50;
TCHAR szBuff[BuffSize] = { 0 };
_strdate_s( szBuff, BuffSize );
csFileNameWithTimeStamp += "_";
csFileNameWithTimeStamp += szBuff;
_strtime_s( szBuff, BuffSize );
csFileNameWithTimeStamp += "_";
csFileNameWithTimeStamp += szBuff;
csFileNameWithTimeStamp += lpctszExtension;
csFileNameWithTimeStamp.Replace( _T( '/' ), _T( '_' ));
csFileNameWithTimeStamp.Replace( _T( ':' ), _T( '_' ));
return csFileNameWithTimeStamp;
}
How to call?
CString csFileName = CreateFileNameWithTimeStamp( _T( "ABC" ), _T( ".txt " ));
Output looks like...
ABC_08_27_08_14_27_34.txt
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|