Hi Vincent,
I haved tryed your code that work fine!.

After reading your code I was able to understand the error and I corrected it:

External_Function WNetGetConnection2 "WNetGetConnectionA" mpr.dll Pointer lpName1 Pointer lpRemoteName Integer lplength Returns Integer

Function funcGetNetConnection Global String sDriveLetter Returns String
Integer iResult iTypeSize
String sStringa
ZeroString 255 to sStringa
Move 255 to iTypeSize
Move (WNetGetConnection2(AddressOf(sDriveLetter) , AddressOf(sStringa), AddressOf(iTypeSize) )) to iResult
Move (CString(sStringa)) to sStringa
Function_Return sStringa
End_Function

Thank you for your suggestion
Best regards