Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. api problem.

api problem.

Scheduled Pinned Locked Moved Visual Basic
helpjsonperformance
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amaneet
    wrote on last edited by
    #1

    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.

    D 1 Reply Last reply
    0
    • A amaneet

      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.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups