Results 1 to 21 of 21

Thread: get a file from document and settings [resolved]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Posts
    86

    Resolved get a file from document and settings [resolved]

    i'm a flash designer and with this flash i can create some sort of cookie
    this cookie wil be stored in documents and settings

    i now exactly were the cookie is been stored the only problem is how can i receive it because
    i have to pas a map that has the username from the person thats online
    for example with me it is

    c:/documents and settings/davyquyo/ .....

    is there a way to receive that some sort of cookie in this map
    because when i'm going to use this litle program on other pc's this name of this map won't be the same

    i hope you understand me
    Last edited by davyquyo; Oct 2nd, 2004 at 03:18 PM.

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989
    You need this done in VB?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Posts
    86
    oops sorry i didn't say this
    wel i creating a program with visual basic 6.0
    and this program wil be running local offcourse

  4. #4
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989
    If I understand correctly, by map, you mean Folder (directory), correct? And you want to get the users profile folder path?

    Like in my case it is C:\Documents and Settings\baja

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Posts
    86
    yes indeed,
    this is the loaction i need to get

    C:\Documents and Settings\davyquyo\Application Data\Macromedia\


    the only problem is tis one map

    i hope you van help me

  6. #6
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989
    in that case you can use API to get the username of the logged in user:

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    4.  
    5. Private Sub Form_Load()
    6.     Dim strUserName As String
    7.  
    8.     'Create a buffer
    9.     strUserName = String(100, Chr$(0))
    10.     'Get the username
    11.     GetUserName strUserName, 100
    12.     'strip the rest of the buffer
    13.     strUserName = Left$(strUserName, InStr(strUserName, Chr$(0)) - 1)
    14.  
    15.     'Show the username
    16.     MsgBox strUserName
    17.  
    18.     MsgBox "C:\Documents and Settings\" & strUserName
    19. End Sub

  7. #7
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989
    You replied before I posted... in that case you need to extract the path from this registry value:

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,AppData

    and to that add: & "\Macromedia"

    To get the registry value data search this forum, it has been covered many times.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Posts
    86
    ok thanks for the help i wil need it
    this should work

  9. #9
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989
    No problem

  10. #10
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    I once installed windows without formatting, but choosing the same user name. Before i reinstalled it was like this:

    John
    Bob
    Administrator

    after, it became:

    John.WINDOWS
    Bob.WINDOWS
    Administrator.WINDOWS
    John
    Bob
    Administrator

    The last three were left over from the install. The ones with the ".WINDOWS" was the real one. I don't know if GetUserName will compensate for that.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    This link to one of my older threads will get the users Application Data
    folder path in the Local Settings directory.


    Application Data Path
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Posts
    86
    ok i try't this

    Option Explicit

    Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

    Private Sub Form_Load()
    Dim strUserName As String

    'Create a buffer
    strUserName = String(100, Chr$(0))
    'Get the username
    GetUserName strUserName, 100
    'strip the rest of the buffer
    strUserName = Left$(strUserName, InStr(strUserName, Chr$(0)) - 1)

    'Show the username
    MsgBox strUserName

    MsgBox "C:\Documents and Settings\" & strUserName
    End Sub

    this says the right name
    davy

    but the map is davy.davy-quyo


    and then i try't this

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders ,AppData
    but he givs error with the red part

    are they other ways to get the right path ???

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Posts
    86
    i found this
    VB Code:
    1. Private Sub Form_Load()
    2. MsgBox Environ(8)
    3. End Sub

    this shows perfectly the path i need
    except for the homepath variable

    how do i remove the first 9 letters

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Posts
    86

    Resolved

    i found it

    i used this

    VB Code:
    1. Private Sub Form_Load()
    2. Dim test2
    3. test2 = Replace(Environ(8), "HOMEPATH=", "")
    4. MsgBox test2
    5.  
    6. End Sub

    this work

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    No. Its usually bad programming to depend upon something that
    can be changed or deleted like enviroment variables.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Posts
    86
    i lookd to the thing you posted bt i can't figure how it works how ill you do it then

  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    I made a working example of how to get the Application data
    path under the users profile. Just add to the path to build
    anything else you need.
    Attached Files Attached Files
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  18. #18

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Posts
    86
    this is great tahnks a lot really

    sorry for the trouble

  19. #19
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    No trouble at all. Just hard code to get your path using the CSIDL_APPDATA
    and add the \Macromedia" folder to the results.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  20. #20

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Posts
    86
    some results are empty

    but i think evrything i need is fine
    tank you very much

  21. #21
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Some are empty because they are virtual folders like the Control Panel, etc.

    Don't forget to resolve this thread if all has been answered.

    Later.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width