FrontPage
>>
MapInfoRoadmap
>>
MapBasicDevelopment
>>
Useful MapBasic Functions/Subs
>>
QueryMIPro? is a function which executes a MapBasic function native to a particular MapInfo Pro version which is more recent than the developer's MapBasic version. It returns a string in this case.
QueryMIPro: Run function in MapBasic window, and return a value
last edited 2 years ago by PhilWaight
Note: The function could (possibly?) be simplified by QueryMIPro? = dderequest$(ichn,procmd_returns_str), and removing the Dim/Undim statements, but as it stands might be a more useful platform for other extensions.
As an example, LocateFile?$() was introduced in version 6.5 MapBasic...
tempstr = QueryMIPro ("locatefile$(10)")
Function QueryMIPro (byval procmd_returns_str as string) as string
'Useful function for a MapBasic version that precedes a user's MI Pro version
'containing a required MapBasic function/statement
'eg. tempstr = QueryMIPro ("locatefile$(10)") 'returns graphsupport directory location
Dim ichn as Integer
onerror goto errhandler
'for errhandler check
ichn = 0
Run Command "dim QMIPROtempstr as string"
Run Command "QMIPROtempstr = " + procmd_returns_str
'handle to MapBasic window environment
ichn = ddeinitiate("MapInfo","System")
QueryMIPro = dderequest$(ichn,"QMIPROtempstr")
ddeterminate ichn
Run Command "undim QMIPROtempstr"
Exit Function
ErrHandler:
Print "Error reported (QueryMIPro) " + Error$()
'should test to see what subsequent error does here...
Run Command "undim QMIPROtempstr"
if ichn <> 0 then ddeterminate ichn end if
Exit Function
End Function