Results 1 to 6 of 6

Thread: Trying to save into D&S on windows 7.. hmmm

  1. #1

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Trying to save into D&S on windows 7.. hmmm

    Hi

    I developed some coding on XP, that uses the Docs and Settings folder on the C Drive.

    I use an API call to get the actual name of the folder path.

    I am now (temporarily) developing on Windows 7.
    Thats not working on Windows 7. At least not the usual way.... But to make matters worse I cannot create a Documents and Settings folder on the C Drive (it claims it already exists - can't see it there).

    Elsewhere on the net it was posted that there is replacement strings to point to other locations, which this looks like it might have done...

    However that knackers my coding in because there is no path to be found...


    Any ideas on how to get it working on the windows 7 without breaking it on the the xp later on..?


    Coding is in MS Access 2010.


    Edit: is there an api or something to detect the version of windows (xp or win 7) ??
    Last edited by Ecniv; Aug 13th, 2013 at 05:13 PM. Reason: missing a bit

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Trying to save into D&S on windows 7.. hmmm

    Edit: is there an api or something to detect the version of windows (xp or win 7) ??
    yes

    what code are you using to get d & s folder name, i have not had problems in w7 32
    are you trying to work with d & s of some user other than the currently logged in user?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Trying to save into D&S on windows 7.. hmmm

    nope - currently logged in user...

    Just on win 7 there is no folder on the c drive d & s, and the code I'm using was the api for gsp...
    Code:
    Public Function GSP(ByVal strFile As String) As String
    '---- feed in a long filename
    '---- it returns the short filename (if existing)
    '---- Get Short Path
    
    'http://support.microsoft.com/kb/175512
        
        Dim strBuffer As String
        Dim lngRes As Long
        
        strBuffer = String(250, 0)
        lngRes = apiGetShortPathName(strFile, strBuffer, 250)
        If lngRes > 0 Then
            GSP = Left(strBuffer, lngRes)
        End If
    End Function
    I was only using this as sometimes the saving of files or opening of files, or in the case of access, (re)linking tables needed a full path and it didn't like the spaces...

    gsp is not returning the path as there is no actual c:\d&s\user\<foldername> ...

    So as a back up option, if I detect the windows version I can rejig the code as required.

    Thanks in advance

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Trying to save into D&S on windows 7.. hmmm

    if I detect the windows version I can rejig the code as required.
    should not be required

    of course there is no documents and settings folder in w7, now it is just users, but the same apis should work, though i tend to just use environ()
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Trying to save into D&S on windows 7.. hmmm

    hmmm - now you mention it.. I tried the dir and the gsp on the d and s folder... and they work...

    Ok - I'll go back and look at the coding... might have pointed to a wrong thing and thats why its not working...


    Thanks for the assist.

    Might post back again soon

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Trying to save into D&S on windows 7.. hmmm

    i can test on w7, if you post all relevant code and api declares

    if the system has been updated from xp or similar the d & s folder may exist, but not be the users documents folder, as recognised by windows
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

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