|
How do I find text in CEdit control?
|
|
|
|
|
First get the text in the edit control using the GetWindowText () or GetDlgItemText () functions
Now use the Find () function of the CString to find the string.
|
|
|
|
|
1st get the text through declaring a CString object type than type cast it to string type.
for example
CString strUpper;
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT);
if (pEdit)
pEdit->GetWindowText(strUpper);
string strNew = (LPCSTR)strUpper;
|
|
|
|
|
If your CEdit is inside a dialog, you may also map it to a CString variable, call dialog's UpdateData method and then call the CString::Find method on such variable.
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]
|
|
|
|
|
How do I highlight the found text?
|
|
|
|
|
CEdit::SetSel [^] lloks promising.
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]
|
|
|
|
|
just a small ? , where is your Edit COntrol box situated?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
|
Hi,
I have changed my resource file added Dialogs however the change doesn't seem to take
would anyone know Where to specify the .rc file as input to the linker on Visual Studio
|
|
|
|
|
UP!
|
|
|
|
|
Don't understand it must be somewhere on Porperty Pages -> Linker maybe -> input ???
|
|
|
|
|
Hello, I downloaded code written in c which consists of many individual files and routines. I would like to use his code to create a plugin for a 3d animation program.
I program graphics using in C++ and only program for my software's API. To be honest with you, I'm not really sure how to go about it. Would it be possible to create a project as I normally do and import all the c and header files into a c++ project? Or do I have to compile his code? And if I do, what do I compile to? a dll or exe or something else? If I do, how do I access those routines?
As you can probably tell, I am very new at this. Any suggestions will be appreciated.
verb
|
|
|
|
|
if you like, you can add the code to your project without change.
and you also can compile the code to a library to use.
|
|
|
|
|
Thank you kcynic,
Yes, I'd prefer to add the code to my project.
tim
|
|
|
|
|
verbatimline wrote: I would like to use his code to create a plugin for a 3d animation program.
That implies a DLL, doesn't it?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
yes I am creating a dll. My plan is to import all the C routines into my project and call them using my c++ code. Is this possible?
tim
|
|
|
|
|
verbatimline wrote: Is this possible?
Yes, as long as those routines are exported correctly.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
if some of those routines are in the form of a
main (argc, argv) function and these functions are called from another routine, what would be the best way to tie all of them together.
I am assuming the individual main functions are compiled as separate dlls or libs and then work together via some sort of interface?
Sorry for the inexperience, I only program in c++ within a single API.
Tim
|
|
|
|
|
verbatimline wrote: if some of those routines are in the form of a
main (argc, argv)
There is only one main() routine (not plural as you have stated). In any case, it will not exist in your DLL.
verbatimline wrote: Sorry for the inexperience, I only program in c++ within a single API.
All the more reason to start small and work your way into something like a DLL.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi David,
You are right. Incorporating C code in my plugin is a big leap for me. But in this case it must be done. I've already learned alot in the process.
Many if not most of the c files have a main(argc, argv) function.
|
|
|
|
|
C and C++ have different naming schemes for function names in object code, so if you try to call a C function "normally" from C++, you'll get an unresolved-external linker error.
So to call a C function from C++, add the 'extern "C"' attribute to its declaration:
extern "C" int myCFunction (int par);
This tells C++ to use the C naming scheme for this function (underscore before the name) rather than the C++ naming scheme (decorated/mangled name).
|
|
|
|
|
|
You can only have one main function. If you need functions in the other files, comment out the extra main methods.
|
|
|
|
|
Hi Alan Thank you for your reply. I was wondering about that. Why would the other c files have a main function? I think the answer lies in the comments of a file with a main function. The coder writes:
I think each c file is a separate little program perhaps?
Tim
modified on Tuesday, April 7, 2009 5:09 PM
|
|
|
|
|
That's what the multiple main () functions would suggest. The important question is whether they have the other functions you need for your application.
|
|
|
|