RobotStudio event

Borland C++ samples [WebWare SDK]

Options
Hi there!

I'm developing my application in Borland C++, but I'm having some dificulty using the ActiveX control under Borland C++.



Is it possible to find any Borland C++ samples out there?
ESTV

Comments

  • RussD
    Options

    vc7app.zip

    Hello,

    I couldn't help you with a Borland sample, but here is a VC++7 sample created on VS.Net 2003. Does anybody else out there use Borland?

    It is very simple. You need an alias called S4 configured in Interlink and running (the Virtual Controller is fine). When you run the application, several controller state data items will be displayed to the UI. When the controller's operating mode is changed, the relevant fields will be updated.

    Note: the comboBox does not have any event handlers wired to it, so clicking on it will have no affect.

    RussD38083,9371412037
    Russell Drown
  • cjfm
    Options
    Thank's for the VC++7 sample.

    Unfortunaly it didn't solve my problem. I can read the status of the controller but I can't send commands like for example "Load a program", "Start a program" or even put it in "Run Mode".



    I've added to the VC++7 sample a button with de following code:

    {

    int __gc *ResultID;

    axHelper1->S4Run(3,ResultID);

    axHelper1->S4Start(0,"main",-1,1,3,ResultID);

    }



    When I push the button the application returns an unhandled exception.

    So, if you could send me a small example on how to put the controller in Run mode and how to start a program, I supose it would solve my problems.



    Thank you once again!

    ESTV
  • RussD
    Options

    Hello,

    I was able to duplicate the condition you reported above. You can avoid this behavior by using an int instead of the int __gc, and passing the argument by reference.

    For example:


    private
    : System::Void btnMOn_Click(System::Object * sender, System::EventArgs * e)
    {
    int ResultID = 0;

    int intRetVal = 0;

    short ResultSpec = 0;

    try


    {
         intRetVal = axHelper1->S4Run(ResultSpec, &ResultID);
    }
    catch(Exception *e)
    {
         lblFileName->Text = e->ToString();
    }
    }
    I think that this will get you past the overall problem you were experiencing, I will post a more detailed sample as time permits.
    Russell Drown
  • cjfm
    Options
    Thank you. The program works fine now on Visual C++ .net.



    As for Borland, the problem should be very similar. I can already do whatever I want to, except commands like S4Start that use a parameter of type wchar_t (also know as type BSTR).



    S4Start(short pgmId, wchar_t *procedure, long noOfCycle, long runMode,short ResultSpec, long* ResultID);



    I'me declaring the procedure parameter like this:

    wchar_t *procedure=L"main";



    but when executing it returns an error of some sort.



    If anybody can tell me something about this it would be great, otherwise I'll have to manage with Visual C++ .NET



    Thank you, one more time!!!

    image
    ESTV