FoxPro and .NET Interop
wwDotnetBridge and instantiating or referencing a static class
Gravatar is a globally recognized avatar based on your email address. wwDotnetBridge and instantiating or referencing a static class
  Rob Williams
  All
  Jun 3, 2020 @ 01:02pm

I am attempting to reference a 3rd party .Net DLL which contains a static class that I need to reference. From my understanding, a static class can not be instantiated. How would I go about referencing any classes, methods, or properties of the static class using wwDotnetBridge?

Gravatar is a globally recognized avatar based on your email address. re: wwDotnetBridge and instantiating or referencing a static class
  Rob Williams
  Rick Strahl
  Jun 4, 2020 @ 02:47pm

Thanks for your quick response.

This got me further, but with some unexpected issues.

If I use CreateObject("wwDotNetBridge") instead of getwwDotNetBridge() the following command fails. loBridge.InvokeStaticMethod("NiceLabel.SDK.PrintEngineFactory.PrintEngine", "Initialize")

This command loLabel = loBridge.InvokeStaticMethod("NiceLabel.SDK.PrintEngineFactory.PrintEngine", "OpenLabel", "C:\Users\Public\Documents\NiceLabel 2019\SDK\Samples\SimpleTestApplication\SimpleSample1.nlbl")

Succeeds with the getwwDotNetBridge() but does not return a reference to the Label but a value of true.

When getwwDotnetBridge() I can not walk through the code to see what is being returned by wwDotnetBride.

Gravatar is a globally recognized avatar based on your email address. re: wwDotnetBridge and instantiating or referencing a static class
  Rick Strahl
  Rob Williams
  Jun 4, 2020 @ 02:52pm

Look at the loBridge.cErrorMsg to find out what went wrong. You probably have to load the external assembly before you can call a static method on a type in it.

+++ Rick ---

© 1996-2024