West Wind .NET Tools and Demos
IntelliSense and wwDotNetBridge
Gravatar is a globally recognized avatar based on your email address. IntelliSense and wwDotNetBridge
  Manni Borg
  All
  Sep 29, 2021 @ 07:31am

Hello,

when calling a COM/DLL with wwDotNetBridge from VFP, is it possible to somehow activate IntelliSense when writing code in the VFP editor?

Thanks, Manni

Gravatar is a globally recognized avatar based on your email address. re: IntelliSense and wwDotNetBridge
  Rick Strahl
  Manni Borg
  Sep 29, 2021 @ 12:07pm

If you're talking about the .NET objects you're accessing then answer in most cases is No. FoxPro's Intellisense can't figure out dynamic objects that are created at runtime. FWIW, that also doesn't work at runtime because you're using a COM object that is dynamically created and doesn't have a typelibrary that FoxPro can parse to get its COM intellisense.

That said there are exceptions for objects that are actually exposed as explicit COM objects. This works with objects you define your self and set the various [ComClass] attributes on or those in the framework that do internally (almost none).

With those you can use their COM interface:

LOCAL loDotnetObject as DotnetComClass.ComServerId

to get Intellisense.

The best you can do is to use a tool like Reflector (look in the Tools folder) to open the DLL file and find the classes you are calling. That will give the you call structures etc.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: IntelliSense and wwDotNetBridge
  Manni Borg
  Rick Strahl
  Sep 29, 2021 @ 04:23pm

Thank you, Tore and Rick!

I tried both of your suggestions and

LOCAL loDotnetObject as DotnetComClass.ComServerId

did the trick for me! 😃

DO wwDotnetBridge
InitializeDotnetVersion("V4") 
LOCAL loBridge as wwDotNetBridge  && didn't make a difference regarding IntelliSense
loBridge = CreateObject("wwDotNetBridge","V4")
loBridge.LoadAssembly("C:\temp\myDotnetComClass.dll")
LOCAL loFox as myDotnetComClass.ComServerId  && this command invokes IntelliSense
loFox = loBridge.CreateInstance("DotnetComClass.ComServerId")

Where can I find the Tools folder to use Reflector?

Thanks, Manni

EDIT: IntelliSense works, because the COM/DLL was registered with RegAsm.exe on my PC. When the DLL is not registered, then IntelliSense is not working. However, this is what I was looking for, to have Intellisense on the developer's PC. On the user's PC the registration is not needed because of wwdotNetBridge.

Gravatar is a globally recognized avatar based on your email address. re: IntelliSense and wwDotNetBridge
  Rick Strahl
  Manni Borg
  Sep 29, 2021 @ 07:35pm

Right - my point is that it only works if the objects are explicitly registered for COM, which most .NET objects are not. You can get your own objects to work, but any of the .NET framework objects (well most anyway) are not available in this way, so no Intellisense.

+++ Rick ---

© 1996-2024