CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Apr 1999
    Posts
    123

    Numerous problems when application is started using "Open with"

    When the file that my application saves is opened using right-click/Open with, there are many mysterious problems:

    1) AfxMessageBox will not work (based on a small sample) from anywhere in the program. It is ignored.

    2) Any files written to temp directory or to the working directory (directory of the opened file) can't be saved because the file path has been mysteriously changed to c:\windows\system32.

    3) Any reference to the directory of the opened file is changed to c:\windows\system32.

    At first I thought this was a Windows security measure but it seems too crazy.

    The program is 13 years old and works fine when the file is opened from inside the program using File > Open or is double-clicked on.

    This recent behavior either started when I upgraded from Visual C++ 6.0 to Visual Studio 2008 or started using Windows 7.

    Any ideas will be must appreciated.
    Last edited by Bob H; July 16th, 2013 at 03:48 PM.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Numerous problems when application is started using "Open with"

    When the file that my application saves is opened using right-click/Open with, there are many mysterious problems:
    Opened with what? How does opening a file created by a program affect the behaviour of the program?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: Numerous problems when application is started using "Open with"

    Quote Originally Posted by Bob H View Post
    ...the working directory (directory of the opened file) ...
    Are you assuming that the directory containing the opened file is your working directory? Then - don't!
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

  4. #4
    Join Date
    Apr 1999
    Posts
    123

    Re: Numerous problems when application is started using "Open with"

    Setting the working directory fixed the problems. Thanks.

    I guess it wasn't necessary when I was compiling with Visual C++ 6.

  5. #5
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: Numerous problems when application is started using "Open with"

    Quote Originally Posted by Bob H View Post
    Setting the working directory fixed the problems. Thanks.

    I guess it wasn't necessary when I was compiling with Visual C++ 6.
    I guess - it has nothing to do with the compiler.
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

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