Home Forums Software Development [Solved] Use EyeX SDK to write visual c++ 2012 windows form programs?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #3552
    Lin, Jr-Hung
    Participant

    Hi:

    The c++ sample provided in the TobiiEyeXSdk-Cpp-1.5.466 works fine
    when write visual c++ 2012 console program. However, when the library
    (EyeX.h, Tobii.EyeX.Client.lib..)is used to write visual c++ 2012
    windows form programs, errors show when callback function is triggered.
    So I am wondering can the library provided can be used in developing
    visual c++ form-based programs? Or the Gaze SDK is the only option to
    write form-based visual c++ programs? Thanks in advanced.

    Best

    #3565
    Jenny [Tobii]
    Participant

    Hi,

    In the console program case you are using unmanaged/native C++ to call the unmanaged/native Tobii.EyeX.Client.dll, which will work fine. In the C++ Windows Forms case you are using Microsoft’s Managed extensions to C++ (MC++) and are trying to call the unmanaged/native dll from managed code which will not work out-of-the-box.

    I think you should be able to use the .Net binding included in the EyeX SDK for .Net instead, when calling from MC++. Download that SDK and take a look at the minimal samples. You will need both the Tobii.EyeX.Client.dll and the Tobii.EyeX.Client.Net20.dll and use the symbols of the latter.

    Included in the EyeX SDK for .Net is also an EyeXFramework.dll, which contains a Windows Forms integration which you should be able to use from MC++. Then you need to have all three dlls in your project. There are Windows Forms samples in C# included in the SDK package.

    #3566
    Lin, Jr-Hung
    Participant

    Dear Jenny:

    Thanks for your fast suggestion. I will try based on your suggestion.
    I am wondering can I use GazeXSDk to develop visual c++ windows form
    applications? Your suggestion is EyeXSDk is capible of developing visual
    c++ windows form app. Does it mean that GazeXSDK can not be used to write such
    app? Or GazeXSDk can be used to develop such app but it is more complicated?

    Thanks again for your suggestions.

    Best

    #3569
    Jenny [Tobii]
    Participant

    Hi,

    The Tobii Gaze SDK has the corresponding level of dll:s. A native Tobii.GazeCore32.dll and a managed Tobii.Gaze.Core.Net.dll. The .Net samples are written in C#.

    Our general recommendation is to use the EyeX SDK because the EyeX Engine runtime takes care of all the setup of the eye tracker, screen setup and user calibration, and also gives you the eye-gaze data in pixel coordinates which automatically adapts if the user changes DPI settings or adds or removes secondary display monitors to the computer, and so on. You can read about the difference between the SDK’s here: http://developer.tobii.com/differences-between-tobii-gaze-sdk-and-tobii-eyex-sdk/

    #4006
    Lin, Jr-Hung
    Participant

    Dear Jenny:

    Thanks for your help. The windows-form based program is finished. It works
    fine. However, when I close the program by clicking the “X” on the upper-right
    of the form, it throw an exception, which seems resulting from a
    multiple-thread issue. My solution is to manually abort the thread. Is there any
    way to avoid the exception when the form is closed?

    Best and Happy New Year

    #4044
    Eddie [Tobii]
    Participant

    Hi,

    Could you please provide the message of the exception?

    I can reproduce an exception which states “0xC0020001: The string binding is invalid.” when creating a minimal test using VC++ WinForms. The solution is to call delete on the EyeXHost member when you are closing the program. Here is one small example:

    public ref class MyForm : public System::Windows::Forms::Form {
    public:
        MyForm(void) {
            // Create EyeXHost
            this->host = gcnew EyeXFramework::EyeXHost();
            this->host->Start();
        }
    
    protected:
        ~MyForm() {
            // Delete EyeXHost to avoid exception
            delete this->host;
        }
    
    private:
        EyeXFramework::EyeXHost^ host;
    };

    Best regards,
    Eddie

    #4045
    Lin, Jr-Hung
    Participant

    Dear Eddie:

    I tested your solution and it worked. Thanks very much.^^

    Best
    John

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.