SessionInfo() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Returns various pieces of information about a running session of MapInfo Pro. You can issue this statement from the MapBasic window in MapInfo Pro.

Syntax

SessionInfo( attribute )

attribute is an integer code indicating which session attribute to query.

Return Value

String

Description

The SessionInfo() function returns information about MapInfo Pro's session status. The attribute can be any of the codes listed in the table below. The codes are defined in MAPBASIC.DEF.

attribute code ID Return Value
SESSION_INFO_COORDSYS_CLAUSE 1 String result that indicates a session's CoordSys clause.
SESSION_INFO_DISTANCE_UNITS 2 String result that indicates a session's distance units.
SESSION_INFO_AREA_UNITS 3 String result that indicates a session's area units.
SESSION_INFO_PAPER_UNITS 4 String result that indicates a session's paper units. For details about paper units, see Set Paper Units statement.
SESSION_INFO_DEFAULT_NATIVE_BLOCKSIZE 5 String result that returns the block size that will be used for creating maps in MapInfo (Native) Tab file format.
SESSION_INFO_DEFAULT_NATIVEX_BLOCKSIZE 6 String result that returns the block size that will be used for creating maps in MapInfo Extended (NativeX) Tab file format.
SESSION_INFO_TEMP_PATH 7 String result with current MapInfoPro session temp folder name and path.
SESSION_INFO_TOKENS_ALL 8

Returns all MapBasic tokens in a semi-colon delimited string.

SESSION_INFO_TOKENS_RESERVED 9

Returns all tokens marked as start tokens, also know as Reserved Words. These tokens cannot be used as table, column, or variable names.

The Session Temporary folder is used by MapInfoPro to store temporary session files such as transaction files (*.tma, *.tda, *.dmp files, etc.)

It is the user's System TEMP folder appended with "\MIPRO\MapInfo.Application.x64_" and the current MapInfoPro.exe process id. For example,
C:\temp\MIPRO\MapInfo.Application.x64_4216\
If users wish to get the current process id of MapInfoPro via MapBasic, they can call the GetCurrentProcessId() Windows API method using this function:
Declare Function GetCurrentProcessId Lib "kernel32" () As Integer

Error Conditions

ERR_FCN_ARG_RANGE (644) error generated if an argument is outside of the valid range.

Example

Include "mapbasic.def"
print SessionInfo(SESSION_INFO_COORDSYS_CLAUSE)