|
hi
i run a thread to show some line in edit box and in every second thread add one line but i want to show only last added ten lines in edit box,how is this possible
thank you
|
|
|
|
|
If I understand it right, your question boils down to: "How can I update the contents in an edit box?" And the answer is, with the help of a member variable.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
...formerly known as brahmma
Codeproject.com: Visual C++ MVP
|
|
|
|
|
hi rajesh
you r absolutely right.can u tell me with the help of some code
|
|
|
|
|
There is no serious coding. Add a member variable to your edit control and name it as m_str . Now, you can alter the value of this variable like: m_str = _T("some new value"); and then call UpdateData(false); to reflect it on the screen.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
...formerly known as brahmma
Codeproject.com: Visual C++ MVP
|
|
|
|
|
i think u r not understanding my problem.i am able to show string in the edit box.but my actual problem is that in every one second i am adding on line.and only want to show 10 lines means i want to erase the one oldest line when the one new line is inserted
|
|
|
|
|
rajneshmalik wrote: and only want to show 10 lines means i want to erase the one oldest line when the one new line is inserted
Use a CStringList to accomplish the same.
Look at CStringList::RemoveHead() function. Your task would become easy with it.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
...formerly known as brahmma
Codeproject.com: Visual C++ MVP
modified on Tuesday, January 08, 2008 9:44:03 AM
|
|
|
|
|
How about keeping the 10 lines in a CStringArray (or similar) object instead? Then the edit control can be updated from this object. Does this sound plausible?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
can i have a check box in the menu pane? if yes then how do i do it?
|
|
|
|
|
have you looked here[^] ?
|
|
|
|
|
yes i just did that now.. what i want is not there in the list of examples. i wnat to add the checkbox where fileopen and print option is there. is it possible?
|
|
|
|
|
its actually not menu pane. its the tool bar. and i dint see any of the articles in the given link. any other leads?
|
|
|
|
|
any leads to the above mentioned query. i need to know how to add a checkbox in the tool bar.
|
|
|
|
|
hi
i have a application to call a object in all classes.
how to make it . help me
k.guru moorthy
|
|
|
|
|
huuu, what ????
which classes ?
which object ?
what have you tried so far ?
|
|
|
|
|
You'll need to be more specific. What do you mean call an object in all classes. Functions get called on instances of classes. Do you want to call all functions on an instance or the same function on all instances or the same name function on instances of different classes?
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Usually applications don't call objects in their classes.
I think that you must should be a bit more precise.
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.
[my articles]
|
|
|
|
|
Hi all,
I'm looking to read a folder which contain number of files. I want to get some details of those files, like Name, Size, Date Created. Those details I can see from the details view of the folder.
To start I try to find the file name as follows.
Try to find the paths of all files included in a folder as follows.
nt CCountOne::SearchDirectory(vector<string> &refvecFiles,const string &refcstrRootDirectory, const string &refcstrExtension, bool bSearchSubdirectories)
{
bSearchSubdirectories = true;
string strFilePath;
string strExtension;
string strPattern;
HANDLE hFile;
WIN32_FIND_DATA FileInformation;
strPattern = refcstrRootDirectory + "\\*.*";
hFile = ::FindFirstFile(strPattern.c_str(), &FileInformation);
int iCount = 0;
if(hFile != INVALID_HANDLE_VALUE)
{
do
{
if(FileInformation.cFileName[0] != '.')
{
strFilePath.erase();
strFilePath = refcstrRootDirectory + "\\" + FileInformation.cFileName;
if(FileInformation.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY)
{
if(bSearchSubdirectories)
{
int iRC = SearchDirectory(refvecFiles, strFilePath, refcstrExtension, bSearchSubdirectories);
if(iRC)
{
return iRC;
}
}
else
{
strExtension = FileInformation.cFileName;
strExtension = strExtension.substr(strExtension.rfind(".") + 1);
cout << strExtension << endl;
if(strExtension == refcstrExtension)
{
refvecFiles.push_back(strFilePath);
}
}
}
else
{
cout << "Error_Two" << endl;
}
}
}while(::FindNextFile(hFile, &FileInformation) == TRUE);
::FindClose(hFile);
DWORD dwError = ::GetLastError();
if(dwError != ERROR_NO_MORE_FILES)
{
return dwError;
}
}
return 0;
}
</string>
In this code set the folder path and start work.
void CCountOne::GetStart(void)
{
int iRC = 0;
vector<string> vecSrfFiles;
iRC = SearchDirectory(vecSrfFiles, "C:\\Bin Files\\Bin", "srf", true);
if(iRC != 0)
{
cout << "Error_One " << iRC << endl;
}
for(vector<string>::iterator iterSrf = vecSrfFiles.begin(); iterSrf != vecSrfFiles.end(); ++iterSrf)
{
cout << *iterSrf << endl;
}
}
</string></string>
But it don't give any file path. Try to debug and check, seems
if(FileInformation.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY) of code one stuck me with.
Can you guys just look at it.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote:
But it don't give any file path. Try to debug and check, seems
if(FileInformation.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY)
of code one stuck me with.
What exactly is your question?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have a folder with few files. I want to read that folder and get the file name, size, created time and last modified time of each file. The code on my first code is what I have try. Just for testing I try to print the file path in my code if I found a file in folder searching. But it wont work.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Ok, I'll solved my question. Now it is working fine. Thanks for all the replay.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Hello,
I have an icon-style CListCtrl, into which I have inserted dozens of icons. Unfortunately, the icons never wrap onto a new row - they fill the top row, creating an unsightly horizontal scroll bar. I would prefer it if the icons wrapped onto a new row in a resolution-independent manner (so that the icons always filled the width of the CListCtrl), or at least never exceeded a certain width (so I know it won't display a scrollbar unless the user has a desktop resolution that is lower then 800x600, for example).
It is not apparent, having gone through MSDN documentation, codeproject tutorials and randomly googled MFC related pages, how any of this can be done. Could someone tell me what I should do?
Here is a codeproject tutorial. I would like to have large icons display as they do in the image of this dialog:
http://www.codeproject.com/KB/combobox/listctrldemo.aspx[^]
I've also made a considerable effort to copy this project, but cannot figure out why my Icon based CListCtrl won't wrap as described.
Thanks in advance,
Sternocera
|
|
|
|
|
What styles are you using for your list view control?
Have you tried LVS_AUTOARRANGE?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
That's worked nicely, thank you.
|
|
|
|
|
Hi,
I have created a customized menu class which is derived from CMenu.
Can I handle right and left arrow keys on these menu. As CMenu is not derived from CWnd, how can we handle arrow keys on CMenu?
Thx in advance,
Vinayak
|
|
|
|
|
hi...
In my project am using many classes.
for example,
class1, class2, class3, class4, class5... etc.
i was declared like
CThreadClass* My_Thread;
in class1.
i need the same My_Thread variable for class4 and class5.
how can i use a comman variable for all clasess?
please help me....
thanks...
paulraj
|
|
|
|