Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Occasional Visitor
Posts: 1
Registered: ‎11-06-2017

Function to validate license on a pc GeoMedia objects

Hi everyone i search  if GeoMedia Objects have a function to validate the license on a PC, programmation language VB.NET

Thank and have a nice day.

Technical Evangelist
Posts: 1,121
Registered: ‎09-11-2015

Re: Function to validate license on a pc GeoMedia objects

[ Edited ]

Hi Freddy,

 

There's no out-of-the-box component in GeoMedia objects. Not sure if any DLL from Intergraph Licensing could be used, there's of course no support for that. But what you can do is to create Try...Catch block that will try to create a GMMapView object. If an exception occurs, there's a big chance that the license is invalid...

 

...or the objects are improperly registered.

 

Regards,

Jan

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Highlighted
Technical Evangelist
Posts: 1,121
Registered: ‎09-11-2015

Re: Function to validate license on a pc GeoMedia objects

This piece of code throws an exception if there's no license, it's in C# though:

Intergraph.GeoMedia.GeoMedia.Application objGMApp = null;

try
{
    Type GeoMediaType = Type.GetTypeFromProgID("GeoMedia.Application");
    objGMApp = (Intergraph.GeoMedia.GeoMedia.Application)Activator.CreateInstance(GeoMediaType);
    // object dummy = objGMApp.CreateService("GeoMedia.Document");

    Console.WriteLine("GeoMedia Initialized...");
}

catch (Exception e)
{
    Console.WriteLine("Error: " + e.ToString());
}
finally
{
    if (objGMApp != null)
    {
        objGMApp.Quit();
        System.Runtime.InteropServices.Marshal.ReleaseComObject(objGMApp);
    }

    Console.ReadLine();
}

Jan

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.