Personal tools
You are here: Home QueryMIPro: Run function in MapBasic window, and return a value
FrontPage >> MapInfoRoadmap >> MapBasicDevelopment >> Useful MapBasic Functions/Subs >>

QueryMIPro: Run function in MapBasic window, and return a value

Document Actions
last edited 2 years ago by PhilWaight
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.

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 
« December 2008 »
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
 

Powered by Plone, the Open Source Content Management System

This site conforms to the following standards: