×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Attachmate in C#

Attachmate in C#

Attachmate in C#

(OP)
Hi,

Here is my code in VB.NET

CODE -->

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim mySystem As New EXTRA.ExtraSystem
        Dim mySessions As EXTRA.ExtraSessions = mySystem.Sessions
        Dim mySession As EXTRA.ExtraSession = mySessions.Open("C:\test.edp")
        MessageBox.Show(mySession.Screen.GetString(4, 27, 31))
End Sub 

it works perfectly, it opens test.edp and reads some values from the screen.

Now I want to convert it ot C#

CODE -->

private void button1_Click(object sender, EventArgs e)
        {
            EXTRA.ExtraSystem mySystem =(EXTRA.ExtraSystem) new EXTRA.ExtraSystem();
            EXTRA.ExtraSessions mySessions = (EXTRA.ExtraSessions)mySystem.Sessions;
            EXTRA.ExtraSession mySession = (EXTRA.ExtraSession)mySessions.Open("C:\\test.edp");
            MessageBox.Show(mySession.Screen.GetString(4, 27, 31));
        } 

this will produce the following error:
'object' does not contain a definition for 'GetString' and no extension method 'GetString' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)

is it possible to implement it in C#?

please advice.

RE: Attachmate in C#

Don't know C. Do you need to declare screen as an Extra object?

RE: Attachmate in C#

(OP)
still not working

CODE -->

private void button1_Click(object sender, EventArgs e)
        {
            EXTRA.ExtraSystem mySystem =(EXTRA.ExtraSystem) new EXTRA.ExtraSystem();
            EXTRA.ExtraSessions mySessions = (EXTRA.ExtraSessions)mySystem.Sessions;
            EXTRA.ExtraSession mySession = (EXTRA.ExtraSession)mySessions.Open("C:\\ISI Apps\\LU\\Sashi\\AOM.edp");
            EXTRA.ExtraScreen myScreen = (EXTRA.ExtraScreen)mySession.Screen;
            MessageBox.Show(myScreen.GetString(4, 27, 31));
        } 

will generate No overload for method 'GetString' takes '3' arguments

RE: Attachmate in C#

Do you have a reference to the Attachmate Object Library.

RE: Attachmate in C#

(OP)
yes, i've added Interop.EXTRA reference and it works to some extend
for instance the following code will open attachmate window

CODE -->

private void button1_Click(object sender, EventArgs e)
        {
            EXTRA.ExtraSystem mySystem =(EXTRA.ExtraSystem) new EXTRA.ExtraSystem();
            EXTRA.ExtraSessions mySessions = (EXTRA.ExtraSessions)mySystem.Sessions;
            EXTRA.ExtraSession mySession = (EXTRA.ExtraSession)mySessions.Open("C:\\test.edp");
            EXTRA.ExtraScreen myScreen = (EXTRA.ExtraScreen)mySession.Screen;
            mySession.WindowState = 0;
            mySession.Visible = 1;
            //MessageBox.Show(myScreen.GetString(4, 27, 31));
        } 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close