api problem.
-
Hi i am facing a poblem in using the api the api is Private Declare Function GetProfilesDirectory Lib "userenv.dll" Alias "GetProfilesDirectoryA" (ByVal lpProfileDir As String, ByVal lpcchSize As Long) As Boolean and the code is Dim sBuffer As String Dim strPARENT As String sBuffer = "" GetProfilesDirectory(sBuffer, 255) when the control comes to to the execution of the code line GetProfilesDirectory(sBuffer, 255) there occurs the following error Attempting to Read or write the protected memory this is often an indication that other memory is corrupt. please help.
-
Hi i am facing a poblem in using the api the api is Private Declare Function GetProfilesDirectory Lib "userenv.dll" Alias "GetProfilesDirectoryA" (ByVal lpProfileDir As String, ByVal lpcchSize As Long) As Boolean and the code is Dim sBuffer As String Dim strPARENT As String sBuffer = "" GetProfilesDirectory(sBuffer, 255) when the control comes to to the execution of the code line GetProfilesDirectory(sBuffer, 255) there occurs the following error Attempting to Read or write the protected memory this is often an indication that other memory is corrupt. please help.
I take it you're looking for something to give you the path to the
Documents and Settings
folder?? You don't need the API to do it:Imports System.IO
Dim profilesPath As String profilesPath = Path.GetDirectoryName(Environment.GetEnvironmentVariable("USERPROFILE"))
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007