Thanks for the reply. I've used CopyFile myself. I am trying to use the CopyFileEx method to give feedback on the progress of a copy. It contains a CopyProgressRoutine as one of the parameters and that is what I am trying to figure out.
Bruce,
That parameter is a pointer to a CallBack routine. This is one thing you just can't implement directly in VFP, due to VFP's dynamic interpretive nature. One techique to do this, would be to create a Visual Basic control to handle it, and then use this control on your form. Also, it's apparently "trivial" to implement IF you know C++ and you create your own .FLL <g>.
"Actually, if you're willing to put in a tiny bit of effort, callbacks are doable writing a small piece of code in another language. The first and oldest of these mechanisms is to create an FLL in C++ using the VFP API; the FLL would need to publish an entrypoint in itself for each type of callback; you'd get the address of the proper entrypoint from the .FLL as an integer, and then pass that as an integer to the API function. The .FLL would receive the callback, and could then populate VFP memory variables or fields in a cursor; an FLL can directly manipulate the VFP runtime environment. Christof Lange published the VC++ source of an FLL to do just this around 3-4 years ago. It requires working in C++, but most of the work is already done. Obviously, the FLL needs to ship with the app.
The same type of thing could be done with an ActiveX component; the ActiveX component would publish an entrypoint, and populate a collection with results, and can surface an event that VFP could respond to. Again, it involves working in another language like C++ or VB (Dan Appleman's first Win32 API book for VB included sample source code forworking with several types of callbacks), and the component would have to be registered on each target system.
You'll find that the need for callbacks will lessen as the Windows environment evolves - many enumerations can be accomplished using the WMI, and we'll be able to access .NET resources via an Interop layer at worst in the VS.NET release of VFP, and in all likelihood, VFP6 will have some capability to use Interop-wrapped .NET services via COM. We'll know more when the VS.NET beta actually ships. In the meanwhile, you can simply use tools other than VFP to manage C-style DLLs requiring a callback, and expose the services and results through one of the many existing interfacing options like FLLs, C DLLs or COM.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.