C# Call-Out/Call-in

Author: addice@yahoo.com (addice)

I'm trying to integrate some .Net functions/form with MyUnifaceApp (9.3)

I'm finding hard implementing  "Call-in" to a uniface component from My.NetApp to Uniface Environment.

What I want to do is similar to what described in this Uniface Library9.3 article:

"Uniface 3GL Call-in API" that describes how to do this with C and Ucall.dll.

 

Imagine this simple sequence: UnifaceComponent(A) activate     ->.NetComponent(B) activate  -> UnifaceComponent(C)

Is that possible using C#2008 ?

I have realized the first part (A activates B) using .COM interface  and it Works !

But what I need is the Uniface environment handle (See documented ueopen(...); ) to perform a call-back to my uniface instance. I'm not sure that using COM interface this is possible.
 


Andrea

2 Comments

  1. Hi Andrea,

    I am still not 100% sure if the whole process works in uniface;
    but perhaps you can use USAYNC to open Component C from uniface again?

    I think c# uses the same possibilities as c++.
    To connect to uniface routines from abc.cpp, I used

    extern "C" XEXPORT(long)  xdllname(void)
    { char sRequest[1000];  long ret_val = 0;}
     

    HTH, Success, Uli


    Author: ulrich-merkel (ulrichmerkel@web.de)
  2. Here an exhaustive answer from Uniface labs.
    Thanks to Daniel.

    "It is no possible to get a Uniface environment handle in case the .Net Component is instantiated through the COM call-out interface. This information would only be available when the C call-out interface is used! The customer probably has to use uecreate instead of ueopen in order to be able to call back to Uniface. But this would mean that another Uniface instance is started and I'm not sure if this would work very well (since Uniface is actually already up and running). If it "works" then the chances are great that the .Net component has no access to the "data" of the "original" Uniface instance. So this probably is not the way forward for him.

    But in general, there's no straight call-back possible from a COM object that has been instantiated by Uniface through the COM call-out interface. One possible way could be the Message API Utility, which could be used to send an asynchronous message back to the running Uniface instance (using for example the upostmsg.dll, which implements the UPostMessage function).

    What might work is if he would create a piece of C code, which instantiates the .Net component. Uniface then could call the C code using the C call-out interface and from within the C code the Uniface environment handle could be retrieved, which subsequent could be passed to the .Net component. That's the theory and I currently don't know if this also would work in real life (which I would have to test). But I've attached some sample code (see Main.zip), which demonstrates how to call the Uniface C call-in functions from C#."

     


    Author: addice (addice@yahoo.com)