Skip to main content

Uniface forms from C++ using C call-in API

Author: zdenek.socha@fullsys.cz (sochaz)

Hello, I'm trying to show a Uniface form from outside the Uniface. Currently from a simple C++ application. I have realized, that the "new" API with uecreate works fine, but only the batch is supported. There is almost no problem calling a service. But I need to show a form. I have tried to use "old" API and call unifbeg... this is fine and Uniface GUI showed up. Then I can activate a modal form and it works fine. But now I need a non-modal form to be shown. At this point, my win32 console application fails - the form is shown, code returned to my app and my app exited. So I switched to Windows Application (still using C++). Now unifgeb works fine, modal form works fine, but non-modal form just show up and that's all. I can click in the form, but it does not react or do anything. It's not frozen in the meaning of "bitmap", I can even show values from currently selected DropDownList, but that's all. Another strange thing is that unifend is somehow broken. According ulibrary there is a numeric parameter to shut id down or suspend... it acts differently than documented, even though always returning a success (1). Calling unifbeg again fails (or frozen or crash the application). So, my questions are: 1) is anyone successful in showing a non-modal Uniface form if the main application is C++ based (not Uniface)? 2) what's wrong in unifend and am I able to hide the shell window if no longer needed and show it again later on? Any help will be appriciated, kind regards, Zdeněk Socha

Uniface forms from C++ using C call-in API

Author: zdenek.socha@fullsys.cz (sochaz)

Hello, I'm trying to show a Uniface form from outside the Uniface. Currently from a simple C++ application. I have realized, that the "new" API with uecreate works fine, but only the batch is supported. There is almost no problem calling a service. But I need to show a form. I have tried to use "old" API and call unifbeg... this is fine and Uniface GUI showed up. Then I can activate a modal form and it works fine. But now I need a non-modal form to be shown. At this point, my win32 console application fails - the form is shown, code returned to my app and my app exited. So I switched to Windows Application (still using C++). Now unifgeb works fine, modal form works fine, but non-modal form just show up and that's all. I can click in the form, but it does not react or do anything. It's not frozen in the meaning of "bitmap", I can even show values from currently selected DropDownList, but that's all. Another strange thing is that unifend is somehow broken. According ulibrary there is a numeric parameter to shut id down or suspend... it acts differently than documented, even though always returning a success (1). Calling unifbeg again fails (or frozen or crash the application). So, my questions are: 1) is anyone successful in showing a non-modal Uniface form if the main application is C++ based (not Uniface)? 2) what's wrong in unifend and am I able to hide the shell window if no longer needed and show it again later on? Any help will be appriciated, kind regards, Zdeněk Socha

Hi Zdenek, Just a thought; If the UNIFBEG works correctly, and your aps EXEC does an activate of a non-modal form - once control comes back to your 3gl, couldn't you use upostmessage which would end up in the non-modal component ASYNC trigger - and take it from there? You might need to set focus back to window of the non-modal (hidden form) for the ASYNC to fire correctly... Alternatively, what about UPUTAMES? I might be off with the pixies, - there's been some time since I worked with the 3gl.. Regards, Knut


Author: Knut (knut.dybendahl@gmail.com)

Uniface forms from C++ using C call-in API

Author: zdenek.socha@fullsys.cz (sochaz)

Hello, I'm trying to show a Uniface form from outside the Uniface. Currently from a simple C++ application. I have realized, that the "new" API with uecreate works fine, but only the batch is supported. There is almost no problem calling a service. But I need to show a form. I have tried to use "old" API and call unifbeg... this is fine and Uniface GUI showed up. Then I can activate a modal form and it works fine. But now I need a non-modal form to be shown. At this point, my win32 console application fails - the form is shown, code returned to my app and my app exited. So I switched to Windows Application (still using C++). Now unifgeb works fine, modal form works fine, but non-modal form just show up and that's all. I can click in the form, but it does not react or do anything. It's not frozen in the meaning of "bitmap", I can even show values from currently selected DropDownList, but that's all. Another strange thing is that unifend is somehow broken. According ulibrary there is a numeric parameter to shut id down or suspend... it acts differently than documented, even though always returning a success (1). Calling unifbeg again fails (or frozen or crash the application). So, my questions are: 1) is anyone successful in showing a non-modal Uniface form if the main application is C++ based (not Uniface)? 2) what's wrong in unifend and am I able to hide the shell window if no longer needed and show it again later on? Any help will be appriciated, kind regards, Zdeněk Socha

Hi Zdenek, I do not remember the call-in API being restricted to services/batch only. The documentation does not mention this and even seems to suggest that forms should also be possible. This needs to be investigated.  I would recommend that you log a support case for this so that I can work on it. Cheers, Chris Breemer Uniface Technical Support


Author: Chris Breemer (chris.breemer@uniface.com)

Uniface forms from C++ using C call-in API

Author: zdenek.socha@fullsys.cz (sochaz)

Hello, I'm trying to show a Uniface form from outside the Uniface. Currently from a simple C++ application. I have realized, that the "new" API with uecreate works fine, but only the batch is supported. There is almost no problem calling a service. But I need to show a form. I have tried to use "old" API and call unifbeg... this is fine and Uniface GUI showed up. Then I can activate a modal form and it works fine. But now I need a non-modal form to be shown. At this point, my win32 console application fails - the form is shown, code returned to my app and my app exited. So I switched to Windows Application (still using C++). Now unifgeb works fine, modal form works fine, but non-modal form just show up and that's all. I can click in the form, but it does not react or do anything. It's not frozen in the meaning of "bitmap", I can even show values from currently selected DropDownList, but that's all. Another strange thing is that unifend is somehow broken. According ulibrary there is a numeric parameter to shut id down or suspend... it acts differently than documented, even though always returning a success (1). Calling unifbeg again fails (or frozen or crash the application). So, my questions are: 1) is anyone successful in showing a non-modal Uniface form if the main application is C++ based (not Uniface)? 2) what's wrong in unifend and am I able to hide the shell window if no longer needed and show it again later on? Any help will be appriciated, kind regards, Zdeněk Socha

Hi, I seem to remember - in the days long past, if you called Uniface from a 3gl, there was a pre-call you needed to do in order to release the keyboard control from input in the 3gl (in order for Uniface to gain control of the keyboard / structrure editor to fire up). I'm wondering if the unifbeg was modified to release the keyboard control from the 3gl - and something went awry when the non-modal implementation was introduced years ago? Of course, the unifend would probably have been modified too in order to restore the keyboard control back to the 3gl.... Knut


Author: Knut (knut.dybendahl@gmail.com)

Uniface forms from C++ using C call-in API

Author: zdenek.socha@fullsys.cz (sochaz)

Hello, I'm trying to show a Uniface form from outside the Uniface. Currently from a simple C++ application. I have realized, that the "new" API with uecreate works fine, but only the batch is supported. There is almost no problem calling a service. But I need to show a form. I have tried to use "old" API and call unifbeg... this is fine and Uniface GUI showed up. Then I can activate a modal form and it works fine. But now I need a non-modal form to be shown. At this point, my win32 console application fails - the form is shown, code returned to my app and my app exited. So I switched to Windows Application (still using C++). Now unifgeb works fine, modal form works fine, but non-modal form just show up and that's all. I can click in the form, but it does not react or do anything. It's not frozen in the meaning of "bitmap", I can even show values from currently selected DropDownList, but that's all. Another strange thing is that unifend is somehow broken. According ulibrary there is a numeric parameter to shut id down or suspend... it acts differently than documented, even though always returning a success (1). Calling unifbeg again fails (or frozen or crash the application). So, my questions are: 1) is anyone successful in showing a non-modal Uniface form if the main application is C++ based (not Uniface)? 2) what's wrong in unifend and am I able to hide the shell window if no longer needed and show it again later on? Any help will be appriciated, kind regards, Zdeněk Socha

I think that was character mode specific - this old interface dates from the time before we even had Windows. I don't think any much has been changed in unifbeg/unifend and I'd rather not worry about it, instead try to make things work using the newer API if possibl.   Cheers, Chris


Author: Chris Breemer (chris.breemer@uniface.com)

Uniface forms from C++ using C call-in API

Author: zdenek.socha@fullsys.cz (sochaz)

Hello, I'm trying to show a Uniface form from outside the Uniface. Currently from a simple C++ application. I have realized, that the "new" API with uecreate works fine, but only the batch is supported. There is almost no problem calling a service. But I need to show a form. I have tried to use "old" API and call unifbeg... this is fine and Uniface GUI showed up. Then I can activate a modal form and it works fine. But now I need a non-modal form to be shown. At this point, my win32 console application fails - the form is shown, code returned to my app and my app exited. So I switched to Windows Application (still using C++). Now unifgeb works fine, modal form works fine, but non-modal form just show up and that's all. I can click in the form, but it does not react or do anything. It's not frozen in the meaning of "bitmap", I can even show values from currently selected DropDownList, but that's all. Another strange thing is that unifend is somehow broken. According ulibrary there is a numeric parameter to shut id down or suspend... it acts differently than documented, even though always returning a success (1). Calling unifbeg again fails (or frozen or crash the application). So, my questions are: 1) is anyone successful in showing a non-modal Uniface form if the main application is C++ based (not Uniface)? 2) what's wrong in unifend and am I able to hide the shell window if no longer needed and show it again later on? Any help will be appriciated, kind regards, Zdeněk Socha

Hi Chris, according to ulibrary and the documentation of uecreate, there is the parameter runMode and there is written: "runMode—specifies how Uniface is to be initialized (in batch mode or interactive mode). Currently, only batch mode is supported, so you should always set this parameter to 1 (one)." This is why I wrote that only a batch mode is supported. I have tried the value of 0, but it does not work. :-) And activating a form results in an error (something about not enough space to show the form, or something like this). So... if I need a form I need a GUI and therefore I need to call unifbeg... but there is no parameters for unifbeg, so it took me several days to figure out how can I tell it to use my .asn file and my .aps (start-up shell). It's very very limited but it works. After unifbeg... the only way to show a form is urun, but only for modal forms and limited to Execute trigger without any parameter. This is useless for me. So I've tried ueopen and then use a "new" API. What is strange is that modal form works fine, but non-modal forms does not react on mouse-clicks and/or keyboard.... Before logging a support case I wanted to check the community to see if I'm doing something wrong. But I will log a support case now, as you suggested. Kind regards, Zdeněk Socha


Author: sochaz (zdenek.socha@fullsys.cz)

Uniface forms from C++ using C call-in API

Author: zdenek.socha@fullsys.cz (sochaz)

Hello, I'm trying to show a Uniface form from outside the Uniface. Currently from a simple C++ application. I have realized, that the "new" API with uecreate works fine, but only the batch is supported. There is almost no problem calling a service. But I need to show a form. I have tried to use "old" API and call unifbeg... this is fine and Uniface GUI showed up. Then I can activate a modal form and it works fine. But now I need a non-modal form to be shown. At this point, my win32 console application fails - the form is shown, code returned to my app and my app exited. So I switched to Windows Application (still using C++). Now unifgeb works fine, modal form works fine, but non-modal form just show up and that's all. I can click in the form, but it does not react or do anything. It's not frozen in the meaning of "bitmap", I can even show values from currently selected DropDownList, but that's all. Another strange thing is that unifend is somehow broken. According ulibrary there is a numeric parameter to shut id down or suspend... it acts differently than documented, even though always returning a success (1). Calling unifbeg again fails (or frozen or crash the application). So, my questions are: 1) is anyone successful in showing a non-modal Uniface form if the main application is C++ based (not Uniface)? 2) what's wrong in unifend and am I able to hide the shell window if no longer needed and show it again later on? Any help will be appriciated, kind regards, Zdeněk Socha

Hi Zdenek, You are right, I had forgotten about that. It's been a while since I seriously worked on 3GL stuff. Ok I will pick up your support case and get back to you there. If I find a solution (or conclude that there is none...) I will post it here too.   Cheers Chris


Author: Chris Breemer (chris.breemer@uniface.com)