Solved

C++ Builder Problem

Posted on 2000-04-19
6
192 Views
Last Modified: 2010-04-10
Hi there,
I have a major problem with something I am working on.  I just can not seem to get it working.  I am trying to reference a TRichEdit Control from a program which I added into my Project.
I am trying to read in each line from the TRichEdit control and Copy it into a temp buffer.
The name of the Richedit control is: Editor and the form it is on is EditForm(This is an MDIChild Form).

Any help would be much appreciated -Cheers
Elmo
0
Comment
Question by:Elmo_
  • 3
  • 2
6 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2731015
You can use Lines Property. Next is code:
....
   char buff[121];
   int n = RichEdit1->Lines->Count;
   for (int i = 0; i < n; i++)
     {
       AnsiString ptr = RichEdit1->Lines->Strings[i];
       strcpy(buff, ptr.c_str());
     }
.....

I hope, it helps. Alex
0
 
LVL 3

Author Comment

by:Elmo_
ID: 2731102
Alex,
      I am still getting the same problem.  I get an Error Number 93
"Undefined Symbol 'Editor'.
      Editor is the Label for the Richedit Control which is located on an MDI Child form
called EditForm
      I have tried includeing the header files of the forms so that it might identify
the control but there is still nothing happening.
      Any Ideas...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#include <iostream.h>
#include <conio.h>
#include <vcl.h>
#include "MDIFrame.h"
#include "MDIEdit.h"
#pragma hdrstop


    int Line_Count;
    char Line_Buffer[132];      //Reads in a temp strin - The line
    int Char_Count;

    Line_Count = 0;

    int n = Editor->Lines->Count;

    for (int i = 0; i < n; i++)
        {
        AnsiString ptr = Editor->Lines->Strings[i];
        strcpy(Line_Buffer, ptr.c_str());
        Line_Count++;
        Char_Count = 0;
        Inspect_Line(&Char_Count, Line_Buffer, &Line_Count);
        }

Thanks alot for your Time,
      Elmo_
0
 
LVL 3

Author Comment

by:Elmo_
ID: 2731106
Alex,
      I am still getting the same problem.  I get an Error Number 93
"Undefined Symbol 'Editor'.
      Editor is the Label for the Richedit Control which is located on an MDI Child form
called EditForm
      I have tried includeing the header files of the forms so that it might identify
the control but there is still nothing happening.
      Any Ideas...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#include <iostream.h>
#include <conio.h>
#include <vcl.h>
#include "MDIFrame.h"
#include "MDIEdit.h"
#pragma hdrstop


    int Line_Count;
    char Line_Buffer[132];      //Reads in a temp strin - The line
    int Char_Count;

    Line_Count = 0;

    int n = Editor->Lines->Count;

    for (int i = 0; i < n; i++)
        {
        AnsiString ptr = Editor->Lines->Strings[i];
        strcpy(Line_Buffer, ptr.c_str());
        Line_Count++;
        Char_Count = 0;
        Inspect_Line(&Char_Count, Line_Buffer, &Line_Count);
        }

Thanks alot for your Time,
      Elmo_
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 3

Author Comment

by:Elmo_
ID: 2731341
Alex,
I am still getting the same problem.  I get an Error Number 93
"Undefined Symbol 'Editor'.
Editor is the Label for the Richedit Control which is located on an MDI Child form
called EditForm
I have tried includeing the header files of the forms so that it might identify
the control but there is still nothing happening.
Any Ideas...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#include <iostream.h>
#include <conio.h>
#include <vcl.h>
#include "MDIFrame.h"
#include "MDIEdit.h"
#pragma hdrstop


    int Line_Count;
    char Line_Buffer[132]; //Reads in a temp strin - The line
    int Char_Count;

    Line_Count = 0;

    int n = Editor->Lines->Count;

    for (int i = 0; i < n; i++)
        {
        AnsiString ptr = Editor->Lines->Strings[i];
        strcpy(Line_Buffer, ptr.c_str());
        Line_Count++;
        Char_Count = 0;
        Inspect_Line(&Char_Count, Line_Buffer, &Line_Count);
        }

Thanks alot for your Time,
Elmo_
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 50 total points
ID: 2731570
You must simple add in you h/cpp file:
extern *TRichEdit Editor;
(if  Editor is name of you RichEdit
Control)
0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 2732165
You ALMOST have it... note the refrence to EditForm->Editor...



Good luck!!


#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#include <iostream.h>
#include <conio.h>
#include <vcl.h>
#include "MDIFrame.h"
#include "MDIEdit.h"
#pragma hdrstop


    int Line_Count;
    char Line_Buffer[132]; //Reads in a temp strin - The line
    int Char_Count;

    Line_Count = 0;

    int n = EditForm->Editor->Lines->Count;

    for (int i = 0; i < n; i++)
        {
        AnsiString ptr = EditForm->Editor->Lines->Strings[i];
        strcpy(Line_Buffer, ptr.c_str());
        Line_Count++;
        Char_Count = 0;
        Inspect_Line(&Char_Count, Line_Buffer, &Line_Count);
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now