|
NYTSX wrote: I would like to keep the last 200 or so lines of text in my CEdit box.
If the lines are not too long, perhaps a listbox would be a better choice. Add lines 1-200 to the control, and when the 201st line is added, simply delete the first (oldest) line from the control. Make sense?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Unfortunately this is a older application that I am updating since now there is more traffic going to the screen and it uses a CEdit box.
I originally thought about using a listbox, but the commands actually span across multiple lines and of course I don't have time or the budget to completely over haul the app.
Have any more suggestions? Is there a way I can access the 64kb buffer that is allocated for the control?
Thanks!
|
|
|
|
|
NYTSX wrote: Have any more suggestions?
Yes. How about using a CStringArray ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
>I would like to keep the last 200 or so lines
here is an idea ...
CString cs;
for(i=0;i<200;i++){cs += "\r\n";}
cs = AddLastRemoveFirst("these two lines are added to the end\r\nand two lines are removed from the beginning",cs);
CString AddLastRemoveFirst(CString StringToAdd, CString StringToAddTo)
{
CString newline("\r\n");
StringToAdd += newline;
int i ;
i = StrToAdd.Find(newline);
while(i != -1)
{
StringToAddTo = StringToAddTo.Mid(StringToAddTo.Find(newline) + 2) ;
StringToAddTo += StringToAdd.Left(i) + newline;
StringToAdd = StringToAdd.Mid(StringToAdd.Find(test) + 2);
i = StrToAdd.Find(newline);
}
return StringToAddTo ;
}
|
|
|
|
|
hi
I am developing an MDI application.
I am using DrawText() method to display text on the view.
I want to retrieve the text while clicking on the text.
plz help me if you have the technic to dod that
regards
Arun
|
|
|
|
|
Hi,
Why You are not happy with this link, you have posted the message once again?
http://blogs.msdn.com/oldnewthing/archive/2004/04/23/118893.aspx[^]
I am not familiar with Accessibility API.
I suggest one method, Keep the text information and position expliclitly of all the Text String drawn using drawtext() and on mouse click() select the text from the data using a simple rectangle collision(hit test) from the mouse pos.
Best Regards
Raj.
-- modified at 8:33 Friday 8th June, 2007
|
|
|
|
|
Or make an CObject derived class with "position" and "content" as members.
Then when you click, take check out if the click is where you want. If one object has this point in its "position" range, make whatever you want with the "content"
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
You asked this question again did you see my reply?
|
|
|
|
|
Hi,
That's what I asked him.
BTW, Iam not familiar with accessibility API.
Could you please brief how its working on drawtext.
if not it's ok I will refer it.
Best Regards
Raj
|
|
|
|
|
<br />
ifstream message_file;<br />
TCHAR message[1000];<br />
int i;<br />
message_file.get(message[i++]);<br />
ERROR C2664 : cannot convert parameter 1 from 'TCHAR' to 'char&'
Any suggestions for the above problem
|
|
|
|
|
Hi,
use wifstream in place of ifstream,
it seems your project is unicode defined.
you may use
#ifdef _UNICODE
wifstream message_file;
#else
ifstream message_file;
#endif
Best Regards
Raj
|
|
|
|
|
Why are you mixing Generic-Text Mappings with a class specialized for elements of type char?
Software_Specialist wrote:
TCHAR message[1000];
Try to change the above with:
char message[1000];
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.
|
|
|
|
|
well i am well confused now. okay pls have a look over this post of mine where i discussed mainly about char variable...
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&select=2073148&df=100&fr=26
Now all of them said me to use TCHAR in place of char or wchar_t..
I have not defined UNICODE...All of them said that TCHAR can handle both UNICODE nad non UNICODE ...So its always better to use TCHAR.
Now i am finished changing every related char to TCHAR and left with 1 error which i asked ...
Well yeh i am rewriting mfc VC++ code to VS2005(MFC)...so am facing promlems...m new to MFC...
Now if ill change message back to char ill again get many errors so that means i have to change everything again....and would end up in never ending error loop....
Any other way out...?
Thanks
|
|
|
|
|
Hi,
Yes, It's nice choice of using generic text mapping function.
So that you can compile both in unicode and non unicode version.
Well C++ stream class has both version,
whar_t version of "ifstream" is "wifstream", "cin" is "wcin", ...
but i don't know the generic mapping for these class.
map these classes yourself for unicode and other version.
Best Regards
Raj
|
|
|
|
|
Software_Specialist wrote: Now all of them said me to use TCHAR in place of char or wchar_t..
I have not defined UNICODE...All of them said that TCHAR can handle both UNICODE nad non UNICODE ...So its always better to use TCHAR.
Well, they're right: actually TCHAR works both for UNICODE and not-UNICODE builds. The same is not true for ifstream that is a class specialized for handling char buffers.
YOu can either follow my suggestion or accept the more elegant solution of Rajkumar_R [^].
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.
|
|
|
|
|
Software_Specialist wrote: I have not defined UNICODE...
This is the default for VS2005. Change ifstream to wifstream as has been mentioned.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
wifstream giving me linking errors....may be i need to change all the ifstream to wifstream....n ofstream to wofstream...
trying to figure this out....
|
|
|
|
|
Software_Specialist wrote: wifstream giving me linking errors...
And those would be?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
ok am getting 4 errors now...
Error 27 error LNK2019: unresolved external symbol "public: void __thiscall hide_in_text::hide_file(class CProgressCtrl *)" (?hide_file@hide_in_text@@QAEXPAVCProgressCtrl@@@Z) referenced in function "public: void __thiscall CABCDlg::OnHide(void)" (?OnHide@CABCDlg@@QAEXXZ) ABCDlg.obj
Error 28 error LNK2019: unresolved external symbol "public: void __thiscall secret_file_class::get_secret_file(void)" (?get_secret_file@secret_file_class@@QAEXXZ) referenced in function "public: void __thiscall CABCDlg::OnHide(void)" (?OnHide@CABCDlg@@QAEXXZ) ABCDlg.obj
Error 29 error LNK2019: unresolved external symbol "public: void __thiscall message_class::convert_to_bits(void)" (?convert_to_bits@message_class@@QAEXXZ) referenced in function "public: void __thiscall CABCDlg::OnHide(void)" (?OnHide@CABCDlg@@QAEXXZ) ABCDlg.obj
Error 30 fatal error LNK1120: 3 unresolved externals N:\ABC\Debug\ABC.exe
|
|
|
|
|
Simply changing ifstream to wifstream caused these linker errors?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
YEH thats true...
Do you think it could be cos i am using TCHAR now. Whereas i guess wifstream supports wchar_t...
Is there any class for TCHAR types...i dont think so..????
|
|
|
|
|
Software_Specialist wrote: Do you think it could be cos i am using TCHAR now.
No, because the preprocessor has resolved those to wchar_t .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
okay
These were my main problems cos of which i first used wchar_t and now TCHAR...
char str[10];
CString Password;
strcpy(str, Password);
In above code i get error saying can not convert parameter 2 from 'CString to const char*'
TCHAR strFilter[1000];
_tcscpy_s(strFilter, "All Files (*.*)|*.*||");
And error i got is none of the 2 overloads could convert all the arguments type.
If i get some other way to deal with this situation... I mean without using wchar_t or TCHAR or L or _T or wcscpy or _tcscpy_s etc etc...then it might work...Dont know really..lez c ..m playing around with it at the moment...
Thanks
|
|
|
|
|
Software_Specialist wrote: _tcscpy_s(strFilter, "All Files (*.*)|*.*||");
Doesn't this require three arguments?
The string literal needs to use _T() or L .
In any case, do you really need to use wchar_t variables?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
# Doesn't this require three arguments?
No it was working ...So i guess its right...anyway i think i hv some problem in one of my function so ill try to modify it a bit....
|
|
|
|