Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Sep 2006
Posts: 23
Reputation: JohnKelly is an unknown quantity at this point 
Solved Threads: 0
JohnKelly JohnKelly is offline Offline
Newbie Poster

Userprofile

 
0
  #1
Jan 14th, 2009
I have a VB6 app that uses the Environ("userprofile") command to determine the location of the My Documents folder for the currently logged in user.

This has been working fine for ages with no problems. One particular client has had the user directory redirected to a network location so that he can back up all the user data. The problem I face is the Environ("userprofile") still returns the local C Drive location for the user and not the mapped network location.

How can I determine where the real user profile has been mapped to ? Is it a registry entry that can be read ?
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Userprofile

 
1
  #2
Jan 14th, 2009
Hi,

Declare this API at the top :

  1. Private Declare Function SHGetFolderPath Lib "shfolder.dll" _
  2. Alias "SHGetFolderPathA" _
  3. (ByVal hwndOwner As Long, _
  4. ByVal nFolder As Long, _
  5. ByVal hToken As Long, _
  6. ByVal dwReserved As Long, _
  7. ByVal lpszPath As String) As Long

to Get the path :

  1. Dim MyPath As String
  2. MyPath = Space(260)
  3. Call SHGetFolderPath(Me.hWnd, 0, -1, &HC, MyPath)
  4. MsgBox MyPath

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 23
Reputation: JohnKelly is an unknown quantity at this point 
Solved Threads: 0
JohnKelly JohnKelly is offline Offline
Newbie Poster

Re: Userprofile

 
0
  #3
Jan 14th, 2009
QVeen72 thanks for the update but is SHGetFolderPath part of the Win32 API. I can't find any record of that call.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 23
Reputation: JohnKelly is an unknown quantity at this point 
Solved Threads: 0
JohnKelly JohnKelly is offline Offline
Newbie Poster

Re: Userprofile

 
0
  #4
Jan 14th, 2009
QVeen72 I have got it working, many thanks for your help I am waiting to see if it reads the clients profile on their system. Thank you once again.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 2
Reputation: 1RealTruth is an unknown quantity at this point 
Solved Threads: 0
1RealTruth 1RealTruth is offline Offline
Newbie Poster

Re: Userprofile

 
0
  #5
Jun 7th, 2009
I've been trying to get the local dynamic user path to work but it doesn't seem to be.

John, what is your original code? Here is what I have but it isn't finding the file. I am using a checkbox and that feature is working but when I have it checked to use the path, it cannot find the file in that path (i.e. default.rdp). I have even tried strPath = Environ("%userprofile%\MyDocu~1") and strPath = Environ("%userprofile%\My Documents")

===> Code <===
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. strPath = Environ("%userprofile%" & "My Documents")
  2. If RDPConsole.Checked = True Then
  3. strRemoteConnect = ("mstsc /edit " & strPath & "default.rdp /v:") & IPBox1.Text
  4.  
  5. Else
  6. strRemoteConnect = ("mstsc /v:") & IPBox1.Text
  7. End If
  8. Shell(strRemoteConnect, vbNormalNoFocus)
Last edited by Tekmaven; Jun 7th, 2009 at 10:00 pm. Reason: Code Tags
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC