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. Can i change window title of SHBrowseForFolder Function.

Can i change window title of SHBrowseForFolder Function.

Scheduled Pinned Locked Moved C / C++ / MFC
9 Posts 5 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.
  • L Offline
    L Offline
    Le rner
    wrote on last edited by
    #1

    Hi all, in SHBrowseForFolder Function when window open its title is "Browse for folder". please tell me can i change it. thanks in advance.

    To accomplish great things, we must not only act, but also dream; not only plan, but also believe.

    D I 2 Replies Last reply
    0
    • L Le rner

      Hi all, in SHBrowseForFolder Function when window open its title is "Browse for folder". please tell me can i change it. thanks in advance.

      To accomplish great things, we must not only act, but also dream; not only plan, but also believe.

      D Offline
      D Offline
      DeepakMega
      wrote on last edited by
      #2

      The SHBrowseForFolder [^] takes in a pointer to a BROWSERINFO[^] structure. You can assign the lpszTitle of BROWSERINFO and pass the BROWSERINFO to SHBrowseForFolder .

      L 1 Reply Last reply
      0
      • D DeepakMega

        The SHBrowseForFolder [^] takes in a pointer to a BROWSERINFO[^] structure. You can assign the lpszTitle of BROWSERINFO and pass the BROWSERINFO to SHBrowseForFolder .

        L Offline
        L Offline
        Le rner
        wrote on last edited by
        #3

        In BROWSERINFO structur the parameter discription like this "lpszTitle Pointer to a null-terminated string that is displayed above the tree view control in the dialog box. This string can be used to specify instructions to the user. " this parameter not change the main window title. please help me.

        To accomplish great things, we must not only act, but also dream; not only plan, but also believe.

        L 1 Reply Last reply
        0
        • L Le rner

          In BROWSERINFO structur the parameter discription like this "lpszTitle Pointer to a null-terminated string that is displayed above the tree view control in the dialog box. This string can be used to specify instructions to the user. " this parameter not change the main window title. please help me.

          To accomplish great things, we must not only act, but also dream; not only plan, but also believe.

          L Offline
          L Offline
          Le rner
          wrote on last edited by
          #4

          LPMALLOC pMalloc;
          LPITEMIDLIST pidl;
          TCHAR szPath [MAX_PATH]; // not used
          BROWSEINFO bi = { GetSafeHwnd(), NULL, szPath,
          _T("Test title for browse dialog"),
          BIF_VALIDATE|BIF_UAHINT|BIF_NEWDIALOGSTYLE|BIF_NONEWFOLDERBUTTON|BIF_RETURNONLYFSDIRS, NULL, NULL };

          pidl = SHBrowseForFolder ( &bi );
          
          if ( NULL != pidl )
          {
          	
          	SHGetMalloc ( &pMalloc );
          	pMalloc->Free(pidl);
          	pMalloc->Release();
           }	
          

          here the window title is remain same "Browse for folder",and "Test title for browse dialog" comes above on dir tree.

          To accomplish great things, we must not only act, but also dream; not only plan, but also believe.

          CPalliniC 1 Reply Last reply
          0
          • L Le rner

            Hi all, in SHBrowseForFolder Function when window open its title is "Browse for folder". please tell me can i change it. thanks in advance.

            To accomplish great things, we must not only act, but also dream; not only plan, but also believe.

            I Offline
            I Offline
            Iain Clarke Warrior Programmer
            wrote on last edited by
            #5

            As you've found out, the lpszTitle member of the BROWSEINFO structure does what it says - changes the text above the tree control, rather than the title. I'd agree that the variabke name is a bit misleading, but the help text tells the truth. Maybe make a browsecallbackproc? The docs say that the first parameter of this callback function is the window of the browese dialog. Could yopu call SetWindowText from there? It passes a BFFM_INITIALIZED message to the proc, so you could change the text very soon. Good luck, Iain.

            I have now moved to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[^]

            L 1 Reply Last reply
            0
            • L Le rner

              LPMALLOC pMalloc;
              LPITEMIDLIST pidl;
              TCHAR szPath [MAX_PATH]; // not used
              BROWSEINFO bi = { GetSafeHwnd(), NULL, szPath,
              _T("Test title for browse dialog"),
              BIF_VALIDATE|BIF_UAHINT|BIF_NEWDIALOGSTYLE|BIF_NONEWFOLDERBUTTON|BIF_RETURNONLYFSDIRS, NULL, NULL };

              pidl = SHBrowseForFolder ( &bi );
              
              if ( NULL != pidl )
              {
              	
              	SHGetMalloc ( &pMalloc );
              	pMalloc->Free(pidl);
              	pMalloc->Release();
               }	
              

              here the window title is remain same "Browse for folder",and "Test title for browse dialog" comes above on dir tree.

              To accomplish great things, we must not only act, but also dream; not only plan, but also believe.

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #6

              You may use the lpfn member of the struct, for instance

              int CALLBACK MyCallback(
              HWND hwnd,
              UINT uMsg,
              LPARAM lParam,
              LPARAM lpData
              )
              {
              if (uMsg == BFFM_INITIALIZED)
              SetWindowText(hwnd, _T("Hi folks"));
              return 0;
              }

              and then

              //...
              BROWSEINFO bi = {
              GetSafeHwnd(),
              NULL,
              szPath,
              _T("Test title for browse dialog"),
              BIF_VALIDATE|BIF_UAHINT|BIF_NEWDIALOGSTYLE|BIF_NONEWFOLDERBUTTON|BIF_RETURNONLYFSDIRS,
              MyCallback,
              NULL
              };

              pidl = SHBrowseForFolder ( &bi );

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              In testa che avete, signor di Ceprano?

              1 Reply Last reply
              0
              • I Iain Clarke Warrior Programmer

                As you've found out, the lpszTitle member of the BROWSEINFO structure does what it says - changes the text above the tree control, rather than the title. I'd agree that the variabke name is a bit misleading, but the help text tells the truth. Maybe make a browsecallbackproc? The docs say that the first parameter of this callback function is the window of the browese dialog. Could yopu call SetWindowText from there? It passes a BFFM_INITIALIZED message to the proc, so you could change the text very soon. Good luck, Iain.

                I have now moved to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[^]

                L Offline
                L Offline
                Le rner
                wrote on last edited by
                #7

                Thank u very much its really helps me.

                To accomplish great things, we must not only act, but also dream; not only plan, but also believe.

                L 1 Reply Last reply
                0
                • L Le rner

                  Thank u very much its really helps me.

                  To accomplish great things, we must not only act, but also dream; not only plan, but also believe.

                  L Offline
                  L Offline
                  Le rner
                  wrote on last edited by
                  #8

                  one more question for browse for folder the ok button enable on my computer type location i want this type of location the ok button should be disable.

                  To accomplish great things, we must not only act, but also dream; not only plan, but also believe.

                  S 1 Reply Last reply
                  0
                  • L Le rner

                    one more question for browse for folder the ok button enable on my computer type location i want this type of location the ok button should be disable.

                    To accomplish great things, we must not only act, but also dream; not only plan, but also believe.

                    S Offline
                    S Offline
                    Stuart Dootson
                    wrote on last edited by
                    #9
                    1. You can set the ulFlags member of the BROWSEINFO structure you pass to SHBrowseForFolder to specify that (for example) you only want file-system directories. 2) You can implement functionality in the BrowseCallbackProc[^] to enable/disable the OK button.

                    Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                    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