Windows Explorer -Libraries - Documents - New
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Windows Explorer -Libraries - Documents - New

  1. #1
    Join Date
    Apr 2002
    Posts
    121

    Windows Explorer -Libraries - Documents - New

    Hello,

    I have an application that Opens files with different extensions for viewing purposes only

    I use MFC with Multi-Document template.

    When I go to Windows Explorer in Windows 7 and right-click on Libraries - Documents, and scroll down to New, Explorer shows multiple links for creating new files with these different extensions.

    My application does not create New documents. It just opens them for viewing purposes. In fact, I have disabled the New portion of the mainframe window.

    My code includes:
    EnableShellOpen();
    RegisterShellFileTypes(TRUE);

    I am at a loss as to what portion of my code would have placed these links into Windows Explorer!

    Is there any way to prevent them from being created in the first place?

    Thanks.

  2. #2
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    3,926

    Re: Windows Explorer -Libraries - Documents - New

    this is part of what RegisterShellFileTypes(TRUE) does.
    you can call it with false instead. This will however also disable the shell print and printto verbs, and not register an icon...

    You may need to provide your own version of the register function to make it specifically do what you want it to do.

  3. #3
    Join Date
    Apr 2002
    Posts
    121

    Re: Windows Explorer -Libraries - Documents - New

    Hello,
    thanks for the reply.

    I don't really want to disable the shell print and open because they are quite useful.

    I looked at the docmgr.cpp where the RegisterShellFileTypes function is.

    I found this code:

    if (bCompat)
    {
    strTemp.Format(_afxShellNewFmt, (LPCTSTR)strFilterExt);
    (void)_AfxSetRegKey(strTemp, _afxShellNewValue, _afxShellNewValueName);

    }

    If I comment this code out, do you think it will prevent Windows from adding New links to the Explorer - Libraries folder?

    thanks...

  4. #4
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,027

    Re: Windows Explorer -Libraries - Documents - New

    No, modifying MFC framework source code isn't a solution because isn't possible for you to rebuild MFC libraries.
    Each time you want to change some default implementation, find a virtual function to override.
    Unfortunately, CDocManager::RegisterShellFileTypes isn't virtual, so you have to go upper and override CWinApp::RegisterShellFileTypes.
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

  5. #5
    Join Date
    Apr 2002
    Posts
    121

    Re: Windows Explorer -Libraries - Documents - New

    Thank you..

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center