Results 1 to 4 of 4

Thread: Embed Attachmate Extra! X-treme session in Windows Forms App

  1. #1
    apateldelta NNTP User

    Embed Attachmate Extra! X-treme session in Windows Forms App

    I am looking to embed Attachmate Extra! X-treme session in a .net Windows Form application. I also need it to be interactive(sending and capturing screen data) with other elements of my application.
    Is there specific control which can help me embed the Session screen within my application and interact with the screen data. Any help is greatly appreciated.


  2. #2
    Join Date
    May 2016

    Re: Embed Attachmate Extra! X-treme session in Windows Forms App


    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.

    These forums are peer-to-peer, best effort, volunteer run and that if your issue
    is urgent or not getting a response, you might try one of the following options:

    - Visit https://www.microfocus.com/support-and-services and search the knowledgebase and/or check
    all the other self support options and support programs available.
    - Open a service request: https://www.microfocus.com/support
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.microfocus.com)
    - You might consider hiring a local partner to assist you.

    Be sure to read the forum FAQ about what to expect in the way of responses:

    Sometimes this automatic posting will alert someone that can respond.

    If this is a reply to a duplicate posting or otherwise posted in error, please
    ignore and accept our apologies and rest assured we will issue a stern reprimand
    to our posting bot.

    Good luck!

    Your Micro Focus Forums Team

  3. #3
    Join Date
    Jun 2016

    Re: Embed Attachmate Extra! X-treme session in Windows Forms

    On the form you want to embed an EXTRA window, place a "GroupBox" control on the form, and remove any caption on the group box. This will become the parent window for EXTRA, and this will allow you to size and place it on the form appropriately, so that you can easily include other buttons or things on the form.

    Use the EXTRA COM API to open an EXTRA session. Use EXTRA's "Sessions.Open" method to do this. The session will open and connect, but will still be invisible.

    Get the handle for the session using the "WindowHandle" property of the EXTRA "_Session" object, and save this in an IntPtr variable.

    Use the Win32 "SetParent" API to cause the group box window on the form to become the parent window for EXTRA.

    After doing this, you will probably want to remove the title bar from the EXTRA window, so it will look more embedded, and not like it just got stuck on the form. To do this, use the Win32 "GetWindowLong" function to get the window style flags for the EXTRA window, turn off the caption-style using the bitwise "not" operator, then use "SetWindowLong" to set the edited window style. It is necessary to use "SetWindowPos" after doing this to make the change take place.

    Finally, make the session visible.

    public partial class Form1 : Form
     private const int WS_CAPTION = 0xC00000; 
     private enum SetWindowPosFlags : uint 
     AsynchronousWindowPosition = 0x4000, 
     DeferErase = 0x2000, 
     DrawFrame = 0x0020, 
     FrameChanged = 0x0020, 
     HideWindow = 0x0080, 
     DoNotActivate = 0x0010, 
     DoNotCopyBits = 0x0100, 
     IgnoreMove = 0x0002, 
     DoNotChangeOwnerZOrder = 0x0200, 
     DoNotRedraw = 0x0008, 
     DoNotReposition = 0x0200, 
     DoNotSendChangingEvent = 0x0400, 
     IgnoreResize = 0x0001, 
     IgnoreZOrder = 0x0004, 
     ShowWindow = 0x0040
     private enum WindowLongFlags : int
     GWL_EXSTYLE = -20,
     GWL_ID = -12,
     GWL_STYLE = -16,
     GWL_USERDATA = -21,
     GWL_WNDPROC = -4,
     DWLP_USER = 0x8,
     DWLP_MSGRESULT = 0x0,
     DWLP_DLGPROC = 0x4
     [DllImport("user32.dll", SetLastError=true)]
     static extern int GetWindowLong(IntPtr hWnd, int nIndex);
     static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
     [DllImport("user32.dll", SetLastError = true)]
     static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
     [return: MarshalAs(UnmanagedType.Bool)]
     static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags); 
     public Form1()
     private void Form1_Load(object sender, EventArgs e)
     IntPtr hGroupbox1 = this.groupBox1.Handle;
     EXTRA.ExtraSessions sessions = new ExtraSessions();
     EXTRA._Session sess1 = (_Session)sessions.Open("Session1.edp");
     IntPtr hSess1 = (IntPtr)sess1.WindowHandle;
     SetParent(hSess1, hGroupbox1);
     int getlongval = GetWindowLong(hSess1, (int)WindowLongFlags.GWL_STYLE);
     getlongval = getlongval & ~WS_CAPTION;
     SetWindowLong(hSess1, (int)WindowLongFlags.GWL_STYLE, getlongval);
     SetWindowPos(hSess1, new IntPtr(0), 0, 0, groupBox1.Width, groupBox1.Height, SetWindowPosFlags.FrameChanged);
     sess1.Visible = 1;
    Last edited by vfast; 29-Jun-2016 at 11:48 PM.

  4. #4
    Join Date
    Jun 2016

    Re: Embed Attachmate Extra! X-treme session in Windows Forms

    Did you try this? how did it go?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts