Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Re: CFileDialog, disable "What's This?" menu

Re: CFileDialog, disable "What's This?" menu

Scheduled Pinned Locked Moved C / C++ / MFC
question
9 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mla154
    wrote on last edited by
    #1

    Hello, Does anyone know of a way to disable the "What's This?" menu (appears after right-clicking on certain items)?   I would like to disable it on my "Save As" dialog.   I've created a class for the dialog and it is inherited from the CFileDialog class.   I have looked at many places on the internet, but I'm unable to find what I need.   Any ideas on this would be appreciated.

    Regards, Mike

    D 1 Reply Last reply
    0
    • M mla154

      Hello, Does anyone know of a way to disable the "What's This?" menu (appears after right-clicking on certain items)?   I would like to disable it on my "Save As" dialog.   I've created a class for the dialog and it is inherited from the CFileDialog class.   I have looked at many places on the internet, but I'm unable to find what I need.   Any ideas on this would be appreciated.

      Regards, Mike

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Sounds like you need to remove the WS_EX_CONTEXTHELP style.

      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      M 1 Reply Last reply
      0
      • D David Crow

        Sounds like you need to remove the WS_EX_CONTEXTHELP style.

        "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        M Offline
        M Offline
        mla154
        wrote on last edited by
        #3

        In the OnInitDialog function of my class derived from CFileDialog, I have the following:

        GetParent ()->ModifyStyleEx(WS_EX_CONTEXTHELP, 0);

        The only difference I noticed was that the question mark button, which is normally located to the left of the close button (the X), disappeared.  The What's This? is still showing.

        Regards, Mike

        D 1 Reply Last reply
        0
        • M mla154

          In the OnInitDialog function of my class derived from CFileDialog, I have the following:

          GetParent ()->ModifyStyleEx(WS_EX_CONTEXTHELP, 0);

          The only difference I noticed was that the question mark button, which is normally located to the left of the close button (the X), disappeared.  The What's This? is still showing.

          Regards, Mike

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          I guess I misunderstood what you were after. I do not know of a way of removing that little context menu. I guess you could try hooking the Save As dialog and then intercepting the right-click message.

          "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          M 1 Reply Last reply
          0
          • D David Crow

            I guess I misunderstood what you were after. I do not know of a way of removing that little context menu. I guess you could try hooking the Save As dialog and then intercepting the right-click message.

            "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            M Offline
            M Offline
            mla154
            wrote on last edited by
            #5

            // ---------------------------------------------------------------------------------------------- // myfiledialog.h // ---------------------------------------------------------------------------------------------- #pragma once #include "afxdlgs.h" class CMyFileDialog :      public CFileDialog { public:      CMyFileDialog(void);      ~CMyFileDialog(void);      virtual BOOL OnInitDialog(); }; // ---------------------------------------------------------------------------------------------- // end myfiledialog.h // ---------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------- // myfiledialog.cpp // ---------------------------------------------------------------------------------------------- #include "stdafx.h" #include "myfiledialog.h" #include "resource.h" CMyFileDialog::CMyFileDialog() : CFileDialog(FALSE,0,0,OFN_EXPLORER|OFN_PATHMUSTEXIST|      OFN_HIDEREADONLY|OFN_LONGNAMES|OFN_OVERWRITEPROMPT|     OFN_CREATEPROMPT) { } CMyFileDialog::~CMyFileDialog() { } BOOL CMyFileDialog::OnInitDialog() {      CFileDialog::OnInitDialog();      GetParent ()->ModifyStyleEx(WS_EX_CONTEXTHELP, 0);      return TRUE;   // return TRUE unless you set the focus to a control } // ---------------------------------------------------------------------------------------------- // end myfiledialog.cpp // ---------------------------------------------------------------------------------------------- I hope this helps.

            Regards, Mike

            D 1 Reply Last reply
            0
            • M mla154

              // ---------------------------------------------------------------------------------------------- // myfiledialog.h // ---------------------------------------------------------------------------------------------- #pragma once #include "afxdlgs.h" class CMyFileDialog :      public CFileDialog { public:      CMyFileDialog(void);      ~CMyFileDialog(void);      virtual BOOL OnInitDialog(); }; // ---------------------------------------------------------------------------------------------- // end myfiledialog.h // ---------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------- // myfiledialog.cpp // ---------------------------------------------------------------------------------------------- #include "stdafx.h" #include "myfiledialog.h" #include "resource.h" CMyFileDialog::CMyFileDialog() : CFileDialog(FALSE,0,0,OFN_EXPLORER|OFN_PATHMUSTEXIST|      OFN_HIDEREADONLY|OFN_LONGNAMES|OFN_OVERWRITEPROMPT|     OFN_CREATEPROMPT) { } CMyFileDialog::~CMyFileDialog() { } BOOL CMyFileDialog::OnInitDialog() {      CFileDialog::OnInitDialog();      GetParent ()->ModifyStyleEx(WS_EX_CONTEXTHELP, 0);      return TRUE;   // return TRUE unless you set the focus to a control } // ---------------------------------------------------------------------------------------------- // end myfiledialog.cpp // ---------------------------------------------------------------------------------------------- I hope this helps.

              Regards, Mike

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              Just out of curiosity, why derive a class from CFileDialog rather than just create an instance of it?

              UINT_PTR CALLBACK OFNHookProc( HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam )
              {
              return 0 or 1;
              }

              CFileDialog fd(FALSE, 0, 0,
              OFN_ENABLEHOOK | OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_LONGNAMES | OFN_OVERWRITEPROMPT | OFN_CREATEPROMPT);
              fd.m_ofn.lpfnHook = OFNHookProc;
              fd.DoModal();

              "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              M 1 Reply Last reply
              0
              • D David Crow

                Just out of curiosity, why derive a class from CFileDialog rather than just create an instance of it?

                UINT_PTR CALLBACK OFNHookProc( HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam )
                {
                return 0 or 1;
                }

                CFileDialog fd(FALSE, 0, 0,
                OFN_ENABLEHOOK | OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_LONGNAMES | OFN_OVERWRITEPROMPT | OFN_CREATEPROMPT);
                fd.m_ofn.lpfnHook = OFNHookProc;
                fd.DoModal();

                "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                M Offline
                M Offline
                mla154
                wrote on last edited by
                #7

                The application I'm working with uses a CFileDialog format, except for 2 buttons that have been added to the dialog.   This is the reason for deriving from CFileDialog.    Anyway, after trying your code, I'm still seeing the "What's This?" menu.   When I debug your code, and set a breakpoint in OFNHookProc, the breakpoint is reached several times, but is never reached when I click on a button using the secondary mouse button.   When I click on a button using the secondary mouse button, the "What's This?" menu appears.   I tried both return values (0 and 1 from function OFNHookProc) with no success.

                Regards, Mike

                D 1 Reply Last reply
                0
                • M mla154

                  The application I'm working with uses a CFileDialog format, except for 2 buttons that have been added to the dialog.   This is the reason for deriving from CFileDialog.    Anyway, after trying your code, I'm still seeing the "What's This?" menu.   When I debug your code, and set a breakpoint in OFNHookProc, the breakpoint is reached several times, but is never reached when I click on a button using the secondary mouse button.   When I click on a button using the secondary mouse button, the "What's This?" menu appears.   I tried both return values (0 and 1 from function OFNHookProc) with no success.

                  Regards, Mike

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  Michael Adamus wrote:

                  Anyway, after trying your code, I'm still seeing the "What's This?" menu.

                  I simply provided you a starting point. You'll need to do some research in order to fill in the blanks. There are no guarantees that this will work, but at least you'll have found one more way that doesn't. You can use Spy++ to see the relationships of that dialog. The hook procedure is actually for the child dialog of the main dialog. You can even customize the child dialog by providing your own template.

                  "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  M 1 Reply Last reply
                  0
                  • D David Crow

                    Michael Adamus wrote:

                    Anyway, after trying your code, I'm still seeing the "What's This?" menu.

                    I simply provided you a starting point. You'll need to do some research in order to fill in the blanks. There are no guarantees that this will work, but at least you'll have found one more way that doesn't. You can use Spy++ to see the relationships of that dialog. The hook procedure is actually for the child dialog of the main dialog. You can even customize the child dialog by providing your own template.

                    "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                    M Offline
                    M Offline
                    mla154
                    wrote on last edited by
                    #9

                    OK, thank you for your time and effort.   Hopefully, I'll be able to figure out how Spy++ works by doing my own research.

                    Regards, Mike

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups