Clive,

Why don't you use the Environ() function instead of an API call?


Function GetVariable()

GetVariable = Environ("L5ROOT")

End Function



Sub Main

Dim strReturn As String

strReturn = GetVariable()

End Sub


James F. Koennicke
GIS Programmer
VISTA Information Technologies, Inc.
ph: (703) 428-8205
email: [EMAIL PROTECTED]

-----Original Message-----
From: Clive Taylor
To: [EMAIL PROTECTED]
Sent: 3/31/00 5:37 AM
Subject: MI Why does this DLL call trash MapInfo?

I'm trying to get this routine to work in MapBasic. I developed and
tested it in VB6 where it works fine. I made the needed changes of
syntax Note for Msgbox and Integer for Long but when I run it it
triggers a complete trash of MapInfo. L5ROOT is one of my system
variables.

------------------------------------------------------------------------
-----

Declare Function GetEnvironmentVariable Lib "kernel32" Alias
"GetEnvironmentVariableA" (ByVal lpName As String, ByVal lpBuffer As
String, ByVal nSize As Integer) As Integer

Declare Sub Main
Declare Sub GetVariable

Sub GetVariable()

 Dim pName As String, pBuffer As String * 255, pSize As Integer, Ret As
integer

 pName = "L5ROOT"
 pSize = 255
 Ret = GetEnvironmentVariable(pName, pBuffer, pSize)

 Note pBuffer

End Sub

Sub Main

 Call GetVariable

End Sub

------------------------------------------------------------------------
-----

Any ideas?

regards
Clive Taylor



----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to