Hello,I wantto check company's name (VBA macro) with mdlLicense_getStrings() function, but it's all time crash. What I'm doing wrong?
Option Explicit Private Declare PtrSafe Sub mdlLicense_getStrings Lib "stdmdlbltin.dll" (ByRef theInfoStrings As brandInfo) Private Declare PtrSafe Function mdlLicense_isRegisteredProduct Lib "stdmdlbltin.dll" () As Long Public dblInterval As Double Type brandInfo theUN As String * 64 theUO As String * 64 theComputerName As String * 32 End Type Public Function IsMicroStationRegistered() As Boolean IsMicroStationRegistered = (0 <> mdlLicense_isRegisteredProduct()) End Function Sub CheckCN() Dim licInfo As brandInfo If IsMicroStationRegistered() Then Debug.Print "MicroStation is registered" Else Debug.Print "MicroStation is not registered" End If mdlLicense_getStrings licInfo '''here crash ''MsgBox licInfo.theComputerName, vbInformation, "License Check" End Sub
CE Update 16 v 10.16.03.11
Regards,Julia
Julia Frid said:I want to check company's name (VBA macro) with mdlLicense_getStrings() function, but it's all time crash Type brandInfo theUN As String * 64 theUO As String * 64 theComputerName As String * 32 End Type
Type brandInfo theUN As String * 64 theUO As String * 64 theComputerName As String * 32 End Type
The problem lies with your UDT BrandInfo. It looks like, with V8, that was a set of C-style strings, but has changed with CONNECT to a set of C++ WString objects. AFAIK, there's no way to use or define a WString in VBA, and there's no conversion available between a C++ WString and a VBA String.
BrandInfo
WString
String
Perhaps Robert Hook can advise?
Regards, Jon Summers LA Solutions
ohh, it's really bad news for me. Maybe exist any other way how to check company name (license)?
Regards, Julia
Hi Julia Frid,
I will take a look to see if I can put something together to help return UserName, UserOrganization, and ComputerName from the same (or other) license APIs. I will let you know once I have something tested and can provide.
Bob
Thank You very much!