PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → WinDev as Automation Server
WinDev as Automation Server
Iniciado por guest, 04,feb. 2016 10:44 - 9 respuestas
Publicado el 04,febrero 2016 - 10:44
Is there anyway to get WinDev to be an Automation server?

We are in the early stages of converting a project to WinDev from VFP, we need to add some functionality to the existing application, but I wondered if there was a way to write it in WinDev and automate it from the existing app rather than have to write it twice.

In VFP you can declare a class as OLEPUBLIC and it is then accessible from external applications, I can't find anything in the help files, can anything similar be done in WinDev?

Gary.
Publicado el 04,febrero 2016 - 11:04
Hi Gary,

Yes you can...

1) OLE Integration -> Only from WX towards VFP (not vice versa)
You can direcly do OLE calls out of WX.
Have a look at Automation in the help.
I have several integrations with Excel like this.
You can start looking here: WX Help Page

2) Native Integration -> Bidirectional
I have quite some integrations mostly via a C/C++ bridge by generating a custom DLL buit using Windows Foundation Classes.
If you look in the 'External Languages' folder in your installation directory you'll find samples for Basic, C, C#, Cobol, Fortran, Java and Pascal but unfortunately not for VFP.

I hope this helps...

Cheers,

Peter Holemans
Publicado el 04,febrero 2016 - 13:19
Hello Gary,

to complete Peter's answer, you can ALSO generate a .net assembly in windev, and call any exposed method from anything else that is .net enabled.

Best regards
Publicado el 04,febrero 2016 - 16:21
Looking at the "external language" examples, they all use a function CALLWD(), which I assume must be a function in one of the WinDev DLL files.

If I knew which DLL I could declare it and probably use it from VFP, does anyone know which DLL it's in?

Fabrice, with .Net DLL can I expose windows or just procedures? I could not find much on it in the help file other than how to generate one.

Gary.
Publicado el 04,febrero 2016 - 16:31
forget about ole, that is old technology . in secure environment your program will get problem running .
Publicado el 04,febrero 2016 - 17:27
Hi Gary,

CallWD calls your WD app when it is built as a WX library.
This will create a WDL instead of an exe (yourwdapplication.wdl).
Next it uses the available WX runtime DLL's (WD20....dll) in the same folder to talk with your application built as a .WDL.

I hope this helps,

Peter Holemans
Publicado el 04,febrero 2016 - 20:52
I'm also programming in VFP and WinDev.

WinDev cannot be used as an automation server.

I have 2 techniques for getting stuff done in WinDev but called from VFP.
(1) Put the parameters I want to pass in a temp text file and if I need a response generate a name that WinDev should use. Then RUN the WinDev program passing the file names as parameters. When the response file is available, VFP can continue.

(2) Using the defunct ETechnologia .net integrator, I developed a socket protocol. I can then talk socket to socket.

I have not done it, but another option would be interprocess messaging via the Windows API and DLL calls.

My biggest problem is accessing VFP data from WinDev. The ODBC driver has not proven reliable enough and writing the code to use it is PAINFUL. I was playing with using the OLE Automation capabilities of VFP but got distracted and never got it working.

If you find any better techniques, I would love to know about them.

Best of luck.

Stewart Crisler
Publicado el 04,febrero 2016 - 21:20
Quote
Stewart Crisler

(2) Using the defunct ETechnologia .net integrator, I developed a socket protocol. I can then talk socket to socket.

You've just reminded me that I once wrote a socket type interface between two vfp apps so that they could talk to each other and swap data objects, maybe I'll look out that code and see if it could be of any use here.

Quote
Stewart Crisler



My biggest problem is accessing VFP data from WinDev. The ODBC driver has not proven reliable enough and writing the code to use it is PAINFUL. I was playing with using the OLE Automation capabilities of VFP but got distracted and never got it working.



If you find any better techniques, I would love to know about them.



Stewart Crisler

Actually I have had some success in that direction using HDBOpen() and HExecuteSQLQuery(), there are some restrictions on opening the same VFP table multiple times, but I have worked around that by having a flag to check if the table is already open and using Pete Halsted's data classes, so the data is loaded once into an array of data objects, then I can manipulate from there.

I haven't had to write back to VFP so not sure how that will work.

Gary.
Publicado el 04,febrero 2016 - 22:13
Hi Gary,

with the .net method, I do not remember if you can DIRECTLY expose a window. However, as you can always expose a method that does an open of a window, you can certainly do it in one or two lines of code

Best regards
Publicado el 05,febrero 2016 - 19:34
I agree, reading the data from VFP tables works very smoothly. I have even imported tables into an analysis as XBASE.

It's writing the data that is a real bear. I have it working using SQLExecute() and the ODBC driver. It's building up the set of VFP commands so that ODBC sees it as a block of executable fox code that is very painful.

Stewart Crisler