CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Dec 1999
    Posts
    85

    OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a loc'

    Keep getting weird error "C:\Documents and Settings\LocalService\Desktop refers to a loaction that is unavailable. It could be on a hard drive on this computer, or on a network..."

    Error message screen shot attached, this happens when I click the 'Save In' folder dropdown at the top of the Save file dialog box even though the Folder c:\test is shown on startup in the dropdown.


    This happens everytime!, after this I have selected a file and saved... next time I get same popup message.

    char cPath[MAX_PATH] = { '\0' };
    char FileTitle[MAX_PATH] = { '\0' };

    strcpy(cPath,"test.pdf");


    OPENFILENAME info;
    memset(&info, 0, sizeof(info));
    info.lStructSize = sizeof(info);
    info.lpstrFilter = "PDF Files (*.pdf)\0*.pdf\0All Files (*.*)\0*.*\0\0";
    info.lpstrFile = cPath;
    info.lpstrFileTitle = FileTitle;
    info.nMaxFileTitle = MAX_PATH-1;
    info.nMaxFile = MAX_PATH + 1;
    info.lpstrTitle = "Select a PDF filename to write to";
    info.Flags = OFN_ENABLESIZING|OFN_EXPLORER|OFN_NOREADONLYRETURN|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST;
    info.lpstrDefExt = "pdf";
    if (GetSaveFileName(&info))
    {

    }


    Any ideas?

    Other programs work fine...
    Attached Images Attached Images  

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a lo

    What are you trying to do in the C:\Documents and Settings\LocalService\Desktop folder?
    Who, when, how and why created the Desktop subfolder in the C:\Documents and Settings\LocalService? Usually such a subfolder doesn"t exists.
    Try to delete it (perhaps, your problem is similar to the one described in http://support.microsoft.com/kb/323681/EN-US/#appliesto)
    Victor Nijegorodov

  3. #3
    Join Date
    Dec 1999
    Posts
    85

    Re: OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a lo

    will look at that but I'm not selecting that, note the folder is last saved as c:\test as in the screen shot, as soon as a click the dropdown arrow I get the error.

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a lo

    What happens if you type in the WIndows Explorer address field C:\Documents and Settings\LocalService\Desktop or, at least, C:\Documents and Settings\LocalService?
    Victor Nijegorodov

  5. #5
    Join Date
    Dec 1999
    Posts
    85

    Re: OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a lo

    C:\Documents and Settings\LocalService folder does exist but C:\Documents and Settings\LocalService\Desktop does not.

    so I created a Desktop folder in there and now it's not complaining about navigating the folder to elsewhere than the default c:\test. weird... looks like it is my XP install that has that issue and not others.

    Thanks,
    Hobnob

  6. #6
    Join Date
    Sep 2011
    Posts
    7

    Re: OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a lo

    I have the same error, but creating the "desktop" folder on the LocalService profile is not an option. Here is why.

    My application is running as a service and is distributed to "clients". I cannot tell all clients to create that folder for the application to work. And I cannot make the application run as another user since that application is started by another application (lets call it Launcher). That Launcher launch multiples application as LocalService, like the one I have the problem with.

    For me it sounds like a windows dialog error.

    Thanks.

  7. #7
    Join Date
    Feb 2002
    Posts
    4,640

    Re: OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a lo

    Quote Originally Posted by simonak View Post
    I have the same error, but creating the "desktop" folder on the LocalService profile is not an option. Here is why.

    My application is running as a service and is distributed to "clients". I cannot tell all clients to create that folder for the application to work. And I cannot make the application run as another user since that application is started by another application (lets call it Launcher). That Launcher launch multiples application as LocalService, like the one I have the problem with.

    For me it sounds like a windows dialog error.

    Thanks.
    Not really. A service shouldn't interact directly with the desktop. Opening a dialog is interacting with the desktop, and the default "directory" shown is the user's desktop. The LocalService account has no desktop.

    Viggy

  8. #8
    Join Date
    Sep 2011
    Posts
    7

    Re: OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a lo

    Is there a way to deactive the "desktop" option in an OpenFileDialog ? At Least if the error was shown when choosing the desktop folder I would understand. But getting the error whenever I try to choose a different folder is not acceptable.

  9. #9
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a lo

    Why are you using UI in a service? Usually you should not!
    Victor Nijegorodov

  10. #10
    Join Date
    Sep 2011
    Posts
    7

    Re: OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a lo

    Is there a way by command line to tell with wich user to launch my application ?
    The application is launched by a command line, it's not specified to be launched as a service... I think it's by default.

  11. #11
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a lo

    Excuse me, I cannot understand you:
    Quote Originally Posted by simonak View Post
    I have the same error, but creating the "desktop" folder on the LocalService profile is not an option. Here is why.

    My application is running as a service and is distributed to "clients". ...
    Quote Originally Posted by simonak View Post
    Is there a way by command line to tell with wich user to launch my application ?
    The application is launched by a command line, it's not specified to be launched as a service...
    So, it it a service or is it NOT a service?
    Last edited by VictorN; September 14th, 2011 at 02:58 PM.
    Victor Nijegorodov

  12. #12
    Join Date
    Feb 2002
    Posts
    4,640

    Re: OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a lo

    If your application is a service, the usual way to "interact" with the desktop is to write a client app that the user has to launch. That way, your client app is the one interacting with the user/desktop, and just sends/receives messages from your service app.

    Having said that, I too would like to know, is this a Windows Service, or a Windows Application?

    Viggy

  13. #13
    Join Date
    Sep 2011
    Posts
    7

    Re: OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a lo

    Ok i'm sorry that's it's not clear.

    It is a windows application. In that application we have a menu to load a file. When we choose that option we automatically have the error that the desktop folder does not exist and when I check the path it's looking at "C:\Documents and Settings\LocalService\Desktop". So, I was assuming then that the application was launched as a service and that it was why it was looking at that path.

    Now, I think I understand that a windows application cannot be launched as a service, so why is it looking at the "LocalService" desktop ?

    That is my problem, and like I said creating a desktop folder is not an option since the application is distributed to clients (and we do not want to tell them to create that folder...)

    Thanks.

  14. #14
    Join Date
    Feb 2002
    Posts
    4,640

    Re: OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a lo

    What credentials are you setting before calling the dialog function?

    Viggy

  15. #15
    Join Date
    Sep 2011
    Posts
    7

    Re: OPENFILENAME error 'C:\Documents and Settings\LocalService\Desktop refers to a lo

    I'll have to check, I'm not calling the application directly. I'm using an application that it's purpose is to launch other applications like mine.

    So it's launched by another program. I'll try to find which credentials are used and get back with the info.

Page 1 of 2 12 LastLast

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

Featured