|
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
|
|
|
|
|
You could use COleDateTime::Format() to generate the time stamp. For instance,
COleDateTime DateTime = COleDateTime::GetCurrentTime();
CString TimeStamp = DateTime.Format( _T("%d-%m-%Y_%H-%M"));
CString FileName;
FileName.Format( _T("XYZ_%s.txt"), TimeStamp );
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
There is a class A which is defined like
#include "stdafx.h"
class A
{
public:
A();
~A();
};
static A a;
A::A()
{
int * i = new int[10];
}
A::~A()
{
}
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
Is there a memory leak here; The only diff is here we create the object of the class A as static.
|
|
|
|
|
tom groezer wrote: int * i = new int[10];
tom groezer wrote:
Is there a memory leak here; The only diff is here we create the object of the class A as static.
This (*i) should be deleted right?
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
|
|
|
|
|
That is a memory leak by design.
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]
|
|
|
|
|
CPallini wrote: That is a memory leak by design.
Thought that was a typo, was just too obvious to miss out.
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
|
|
|
|
|
tom groezer wrote: A::A()
{
int * i = new int[10];
}
Even though the object is static, its constructor will be called and the memory allocation in constructor is not deleted else where. So its definitely a leak.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Yes just send that code to raise some interest. Now to fix that I did something like this below
I added that delete statement in bold. I guess this should be perfect. Comments.
#include "stdafx.h"
class A
{
public:
A();
~A();
private:
int* i;
};
static A a;
A::A()
{
int * i = new int[10];
}
A::~A()
{
delete[] i;
}
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
|
|
|
|
|
tom groezer wrote: I guess this should be perfect. Comments.
perfect.
but a question anyway : why didn't you just test it with your debugger ?
ps: also, please format your posts correctly using <pre></pre> tags when you post code snippets...
|
|
|
|