Advanced FoxPro .NET COM Interop Article Series
I've put up a three part article series on advanced FoxPro and .NET Interop topic dealing with handling complex object passing, handling .NET COM events and multi-threading with .NET components. This entry serves as a discussion placeholder for these three articles, so you can leave comments and questions below.
The actual articles can be found here:
1. Passing objects between FoxPro and .NET COM Components
2. Handling .NET Events in FoxPro via COM Interop
3. Creating multi-threaded components .NET for COM Interop with Visual FoxPro
This article is a follow up for the original base article that discussed the basic concepts of COM Interop:
Using .NET Components via COM from Visual FoxPro
Enjoy...
Other Posts you might also like
- Adding minimal OWIN Identity Authentication to an Existing ASP.NET MVC Application
- Resolving Paths To Server Relative Paths in .NET Code
- Map Physical Paths with an HttpContext.MapPath() Extension Method in ASP.NET
- Back to Basics: Rewriting a URL in ASP.NET Core
- Getting the Client IP Address in ASP.NET Core
The Voices of Reason
# re: Advanced FoxPro .NET COM Interop Article Series
There are many scenarios here and many don't work as you would expect, but a combination of COMARRAY and copying the elements and re-writining them gets you around most of them.
Finally if you have a choice in the matter use Collections to pass data rather than arrays. Collections are real objects and it's easier for .NET and Fox both to deal with this type of COM data.
# re: Advanced FoxPro .NET COM Interop Article Series
There seem to be a problem when array is redimensioned or expression for the size is used when declared.
Fox
LOCAL ARRAY col_names[getwordcount(tbl_fields,',')] as String
oBuilder = createobject ( ... )
comarray(( oBuilder, 10 )
oBuilder.Buildindex( @col_names )
Net
public string BuildIndex( string[] columns )
It works OK when array size in Fox is constant.
Using ref C# or changing to passing by value doesn't really help.
# re: Advanced FoxPro .NET COM Interop Article Series
I am having problems with a COM-Server of a CAD software. A function needs a zero based array, as known FP-arrays always start with index 1, but I have no influence on the server.
Do you have an idea?
Best regards and thank you in advance,
Ralf Dörfel from germany
# re: Advanced FoxPro .NET COM Interop Article Series
ok I have found your article :-):
http://west-wind.com/weblog/posts/2328.aspx
But I am having the problem with a [m,n] dimensioned array and it still crashes.
Greetings,
Ralf Dörfel from Germany
# re: Advanced FoxPro .NET COM Interop Article Series
Thanks for the great article I'm using VFP 7 though and having trouble getting the hardcoded path to the type library in the "Implements IN" parameter changed the the COM progid. Foxpro says it can't find the type library when I change it to the progid any suggestions as to what I am doing wrong?
Thanks,
Curtis
# re: Advanced FoxPro .NET COM Interop Article Series
In 8 and 9 you can use the ProgId of any COM object that's located in the same binary/type library and VFP will find it.
# re: Advanced FoxPro .NET COM Interop Article Series
I'm using VFP 9,
Thanks for the great article!
# re: Advanced FoxPro .NET COM Interop Article Series
# re: Advanced FoxPro .NET COM Interop Article Series
I have this "Type Library Not Foun" too. I'm using VFP9 SP2. Could you help me with some clues? I have none.
Thanks in advance!
Viktor
ps.: simple calls to COM exposed .NET functions work fine, but implementing the interface dies when giving the IMPLEMENTS... part.
# re: Advanced FoxPro .NET COM Interop Article Series
I have a FOX COM using in ASP.NET, and is ok in Windows 2000, but in Windows 2003 when I try return an error : Exception HRESULT: 0x80010105 (RPC_E_SERVERFAULT). There is any special config for FOX COM use in Windows 2003 ? I try with an sample COM with only one Method Hello Word and return error too, but that same code in Windows 2000 work fine .
thanks
Robert
# re: Advanced FoxPro .NET COM Interop Article Series
This works fine:
oInterop = createobject("PocketSIMS.Interop")Next part works fine on development machine, but gives "Type Library PocketSIMS.Interop not found" error on client machine:
DEFINE CLASS InteropStatusEvent AS session OLEPUBLIC
IMPLEMENTS IPocketSIMSEvents IN "PocketSIMS.Interop"
...
ENDDEFINEWhat am I doing wrong?
# re: Advanced FoxPro .NET COM Interop Article Series
# re: Advanced FoxPro .NET COM Interop Article Series
I've come upon your article as a result of searching (in vain) for a good example showing how to expose events from a managed c# object through COM interop services to be subscribed to and handled in an unmanaged C++ client.
Your article gives me some ideas to try but it's clearly different than what I am doing. I'm having trouble with getting the correct event declaration in the interface section of the managed object and then seeing and subscribing to it in the C++ code.
Do you by chance have any pointers?
Thanks.
# re: Advanced FoxPro .NET COM Interop Article Series
i faced with this question that is it possible for us to write com capable components in dot net and register it then this com component act as for example chat server for us?(server keep running this component and our com component listen to special port and perform our desired actions)
# re: Advanced FoxPro .NET COM Interop Article Series
# re: Advanced FoxPro .NET COM Interop Article Series
Very good article.
I want to include a .NET form (Not a window) inside a existing FOX PRO form.
Can you give-me some info in order to achieve this?
Best Regards,
Luis Santos
# re: Advanced FoxPro .NET COM Interop Article Series
I found this example http://www.codeproject.com/KB/miscctrl/exposingdotnetcontrols.aspx .
But my Fox Application give-me a the error "OLE error code 0x80020006" when i try to resize the
window.
Pageframe1.Page2.AddObject("myctrl2","olecontrol","Com.example") Pageframe1.Page2.myctrl2.Visible = .T. Pageframe1.Page2.myctrl2.width = 400 Pageframe1.Page2.myctrl2.height= 400
Can you help-me?
# Advanced FoxPro .NET COM Interop Article Series
This is the code:
do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge
loBridge = CreateObject("wwDotNetBridge")
*** Load our custom assembly and check for errors
IF !loBridge.LoadAssembly("FusionClass.dll")
? loBridge.cErrorMsg
ENDIF
loFusion = loBridge.CreateInstance("FusionClassInterop.FusionInterop")
IF loBridge.lError
? loBridge.cErrorMsg
ENDIF
public status1,statusreturn,substatus,totalbombas,servimode,cade
STORE 0 TO totalbombas
STORE "" TO status1,substatus,servimode,cade
STORE .f. TO statusreturn
** Conectar
*!* loFusion.FusionConnect(&ConfsetIpFusion)
statusreturn = loFusion.FusionConnect("192.168.1.20")
*!* Here is my problem, how i can capture the value of the variable status1
statusreturn = loFusion.ForecourtStatus(status1)
?? status1
# re: Advanced FoxPro .NET COM Interop Article Series
Hi, I've created a DLL COM object in Foxpro and want to use it in ASP.NET Core, so far I've been unable to find a solution and packaging it with Nuget didn't work either whereas I can use this same dll easily in standard ASP.NET. Is there any way to use a Foxpro DLL COM object in ASP.NET Core? or Is there any difference between ASP.NET Core and ASP.NET in using COM objects?
Thanks
# re: Advanced FoxPro .NET COM Interop Article Series
I want to know that can i build a VFP DLL that will create a Excel/ Powerpoint document. this DLL will be called from a .NET Web Page on click of a button. This will generate a Excel /Powerpoint Document on web server and available to user as a hyperlink on the web page.
Please reply to my email id muk944@yahoo.com
i will be highly grateful to you
thanks