Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Additional button on ShBrowseForFolder dialog

Posted on 2002-06-27
7
Medium Priority
?
1,092 Views
Last Modified: 2007-12-19
I managed to place an extra button ('Create new directory') on the ShBrowseForFolder dialog, but when it doesn't seem to do anything if you click it. The event handler procedure in the parent form isn't called.

Could this have anything to do with the fact that ShBrowseForFolder pauses the execution of the calling program? If not, why doesn't this work? (and of course, how do I fix it?)
0
Comment
Question by:herr_apfelschnitt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 8

Expert Comment

by:Cesario
ID: 7114059
Hi herr apfelschnitt, ( cooler name )

The April MSDN implies all you need in addition to the standard use of SHBrowseForFolder is this:

    bi.ulFlags = BIF_USENEWUI;

Best Regards

Cesario
0
 
LVL 1

Author Comment

by:herr_apfelschnitt
ID: 7115130
Hi Cesario

I tried that but it won't compile: it says BIF_USENEWUI is undeclared. (btw i'm using Delphi 3 if that has anything to do with it). ShellAPI and ShlObj are both in the 'uses' clause, and BIF_RETURNONLYFSDIRS isn't a problem.

Maybe you can just give me the value it stands for?

Thx,

herr_apfelschnitt
0
 
LVL 1

Author Comment

by:herr_apfelschnitt
ID: 7115139
Hi Cesario

I tried that but it won't compile: it says BIF_USENEWUI is undeclared. (btw i'm using Delphi 3 if that has anything to do with it). ShellAPI and ShlObj are both in the 'uses' clause, and BIF_RETURNONLYFSDIRS isn't a problem.

Maybe you can just give me the value it stands for?

Thx,

herr_apfelschnitt
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 2

Expert Comment

by:Tasomia
ID: 7115754
const
  BIF_USENEWUI = 28;
0
 
LVL 1

Author Comment

by:herr_apfelschnitt
ID: 7115935
Sorry, this doesn't solve anything. The dialog just looks a bit different, but the button keeps ignoring clicks...
0
 
LVL 7

Accepted Solution

by:
Cynna earned 800 total points
ID: 7131609
Unfortunatly, there is no practical way to refresh
SHBrowseForFolder.
There is one thing, but I don't quite see how is it going
to be of any help....
If you delete folder while parent folder is collapsed,
when you expand parent folder, it will force its refresh.
So you could do a kinf of a hack: create folder, delete
it, and then create it again. *BUT* this has to be done while parent folder is collapsed, which in effect renders
this uselless... just an info.

Also, I don't know what you want to do exactly, but
you might consider using new feature (problem is,
it's introduced only in IE5 and after, so older systems
won't support it). Anyway, if you add flag BIF_NEWDIALOGSTYLE, New Folder feature will be added for you automatically:

const
BIF_NEWDIALOGSTYLE=$0040; // Will create automatically "New Folder" button

use  "... or BIF_NEWDIALOGSTYLE" in your ulFlags.


0
 
LVL 3

Expert Comment

by:darinw
ID: 7132036
Hi everyone,

Cynna provided the answer in a second post from herr_apfelschnitt here:

http://www.experts-exchange.com/delphi/Q_20319670.html

and the answer was:
--begin--

Accepted Answer

From: Cynna
Date: 07/04/2002 05:43PM PST

herr_apfelschnitt,

You are creating a TButton on a non-VCL control, and trying to
use its OnClick event. Generally, using CreateParented() is a
bad idea for anything other then ActiveX.
You should tackle your problem by directly creating button
on foreign window through raw API functions. Message should
be handled by your own window procedure.

Since you offered 300 points, I took time to code your
problem ;-), so you could just Copy/Paste it, it should work
right away...


const
 BUTTON_ID = 255;

var
 browseNewDirBtn : Hwnd; // <-- not TButton any more !

// (....)


function browseNewDirBtn_Clicked(HWindow: HWND; Msg: UINT;
                                wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
begin
 Result:=0;
 if (Msg=WM_COMMAND) and (Lo(wParam)=BUTTON_ID) then begin
   Form1.Caption:='Button Clicked!';
   ShowMessage('Look at the form caption...');
   // ------------------------------
   // ...do your stuff here....
   // ------------------------------
 end
 else Result:=DefDlgProc(HWindow,Msg,wParam,lParam);
end;


function BrowseCallBackProc(H: Hwnd; UMsg: UINT; lParam: lParam; lpData: lParam): Integer; stdcall;
begin
case UMsg of
   BFFM_INITIALIZED: begin // This is only change - no VCL button!
                         browseNewDirBtn := CreateWindow('BUTTON', 'Into new dir...',
                                                      WS_CHILD or WS_VISIBLE,
                                                      10, 269, 100, 30,
                                                      H, BUTTON_ID, HInstance, nil);
                         SendMessage(browseNewDirBtn, WM_SETFONT,
                                     WPARAM(Form1.Font.Handle), 1);
                         SetWindowLong(H,GWL_WNDPROC,Longint(@browseNewDirBtn_Clicked));
                     end;

   BFFM_SELCHANGED:  begin
                     if (lpData <> 0) then
                     begin
                     ShGetPathFromIDList(PItemIDList(lpData), currSelectedFolder);
                     end else
                         currSelectedFolder := '';
                     end;
end;
Result := 0;
end;

--end--

darinw
Former EE CS Guy
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question