I'm not sure if it works, but try the following... At least it's not
thrashing MI on my NT machine
Bo Thomsen
GeoConsult I/S
Denmark
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, pSize As Integer, Ret As integer
' ******* Dim pBuffer as string
pName = "L5ROOT"
pSize = 255
' ****** Fill pBuffer with space - characters
pBuffer = Space$(pSize)
Ret = GetEnvironmentVariable(pName, pBuffer, pSize)
' ****** Remove unused space characters
Note left$(pBuffer,Ret)
End Sub
> -----Oprindelig meddelelse-----
> Fra: Clive Taylor [SMTP:[EMAIL PROTECTED]]
> Sendt: 31. marts 2000 12:37
> Til: [EMAIL PROTECTED]
> Emne: 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]