BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

new style OpenDialog with BCB4

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Gord
Guest





PostPosted: Thu Apr 22, 2004 12:46 am    Post subject: new style OpenDialog with BCB4 Reply with quote



Okay maybe its not new anymore, but I would like to get the "new" style
open dialog with BCB4 under Windows 98 (or anything higher). I'm
referring to the dialog with the left pane that shows folders such as
Favorites, My Documents, Desktop, etc. Anything written with a modern
compiler should do it. However, I'm hesitant to upgrade right now until
the whole VCL/BCB/CBX thing is clarified.

Thanks

Back to top
Pete Fraser
Guest





PostPosted: Thu Apr 22, 2004 8:27 am    Post subject: Re: new style OpenDialog with BCB4 Reply with quote



It's there in BCB6 along with a whole host of other fixes.
You should also be able to do it using the Windows API - look at MSDN site
at Microsoft.com which should tell you which flags to use when creating the
dialog.

"Gord" <gp.mail.no.spam (AT) telus (DOT) no.spam.net> wrote

Quote:
Okay maybe its not new anymore, but I would like to get the "new" style
open dialog with BCB4 under Windows 98 (or anything higher). I'm
referring to the dialog with the left pane that shows folders such as
Favorites, My Documents, Desktop, etc. Anything written with a modern
compiler should do it. However, I'm hesitant to upgrade right now until
the whole VCL/BCB/CBX thing is clarified.



Back to top
Gord
Guest





PostPosted: Thu Apr 22, 2004 1:51 pm    Post subject: Re: new style OpenDialog with BCB4 Reply with quote



I was suspecting that I would have to dive into the WinAPI and MSDN. I was
just hoping there was an easier way or some component I haven't stumbled
across.

I'm not interested in investing money into BCB6 yet until I know what the heck
Borland is doing with C++/VCL etc. I'll try to stretch BCB4 as far as I can
until the path is clear.

- - - - - -

Pete Fraser wrote:

Quote:
It's there in BCB6 along with a whole host of other fixes.
You should also be able to do it using the Windows API - look at MSDN site
at Microsoft.com which should tell you which flags to use when creating the
dialog.



Back to top
Timothy H. Buchman
Guest





PostPosted: Thu Apr 22, 2004 6:10 pm    Post subject: Re: new style OpenDialog with BCB4 Reply with quote

Gord <gp.mail.no.spam> wrote

Quote:
I was suspecting that I would have to dive into the WinAPI and MSDN.
I was
just hoping there was an easier way or some component I haven't
stumbled
across.

Because I only have BCB3 and BCB6, I can't give you specific advice.
But I suggest that you read the second article on this page:
http://msdn.microsoft.com/msdnmag/issues/0400/c/default.aspx

It's in terms of MFC, but the VCL places similar barriers between the
Windows API and the programmer (while saving a lot of bother, you'll
have to admit.) Two key questions are the OS version of the end-user,
and the structure size for OPENFILENAME in the BCB4 VCL. Note in
reading the cited article that the Open dialog is always hooked by the
VCL.

In fact, I did a little experimentation with trying to get a BCB6 app
to display the places bar on a Win98SE machine (or was it the other
way around?). I built a larger OPENFILENAME structure, copied the
smaller VCL one into the appropriate parts, and stuffed it into the
VCL. But I found (as in the article above) I couldn't get it to work.
You can probably get what you need with a pure API call, *if* BCB4 has
the right Windows version number.

--
Timothy H. Buchman
========================================
City Center Theater, New York NY
mail address tbuchmanPLEASE(at sign)REMOVEcitycenter.org
Search .borland message archive on http://www.tamaracka.com/search.htm


Back to top
Gord
Guest





PostPosted: Thu Apr 22, 2004 7:52 pm    Post subject: Re: new style OpenDialog with BCB4 Reply with quote

Thanks Timothy

I'll check it out. I came across your name when I searched the groups for
help on this topic. I'm glad you distilled the relevant part of your
previous investigation.

Gord


"Timothy H. Buchman" wrote:

Quote:
Because I only have BCB3 and BCB6, I can't give you specific advice.
But I suggest that you read the second article on this page:
http://msdn.microsoft.com/msdnmag/issues/0400/c/default.aspx

It's in terms of MFC, but the VCL places similar barriers between the
Windows API and the programmer (while saving a lot of bother, you'll
have to admit.) Two key questions are the OS version of the end-user,
and the structure size for OPENFILENAME in the BCB4 VCL. Note in
reading the cited article that the Open dialog is always hooked by the
VCL.

In fact, I did a little experimentation with trying to get a BCB6 app
to display the places bar on a Win98SE machine (or was it the other
way around?). I built a larger OPENFILENAME structure, copied the
smaller VCL one into the appropriate parts, and stuffed it into the
VCL. But I found (as in the article above) I couldn't get it to work.
You can probably get what you need with a pure API call, *if* BCB4 has
the right Windows version number.

--
Timothy H. Buchman
========================================
City Center Theater, New York NY
mail address tbuchmanPLEASE(at sign)REMOVEcitycenter.org
Search .borland message archive on http://www.tamaracka.com/search.htm


Back to top
Timothy Buchman
Guest





PostPosted: Sat Apr 24, 2004 5:29 pm    Post subject: Re: new style OpenDialog with BCB4 Reply with quote

Just to get it on the record, I found my BCB6 efforts. I apparently made a
note in the comments before abandoning the idea. Because the VCL, at
runtime on the target machine, checks the windows version, and substitutes
the OPENFILENAME structure size (see VCL source), I believe the job *cannot*
be done within the VCL.
(header file)
//--------------------------------------------------------------------------
-

#ifndef PlacesDialogH
#define PlacesDialogH
//--------------------------------------------------------------------------
-
#include <SysUtils.hpp>
#include <Classes.hpp>
#include <Dialogs.hpp>
//--------------------------------------------------------------------------
-

// #pragma pack(push, 1)
typedef struct
{
void * pvReserved;
DWORD dwReserved;
DWORD FlagsEx;
}OPENEX;
typedef struct
{ // NOTE special typedef in next line!
OPENFILENAME_NT4 ofn;
OPENEX oex;
} OPDFILENAME;
// #pragma pack(pop)

class PACKAGE TPlacesDialog : public TOpenDialog
{
private:

const DWORD ss;
LPOPENFILENAMEA originaldialogdata;
LPOPENFILENAMEA ourdialogdata;

#pragma pack(push, 1)
OPDFILENAME opddialogdata;
#pragma pack(pop)

protected:
BOOL __fastcall TPlacesDialog::TaskModalDialog(void * DialogFunc,
void* DialogData); // override Dialogs::TOpenDialog method
public:
__fastcall TPlacesDialog(TComponent* Owner);
__published:
};
//--------------------------------------------------------------------------
-
#endif

(.cpp file)
//--------------------------------------------------------------------------
-

#include <basepch.h>

#pragma hdrstop

#include "PlacesDialog.h"
#pragma package(smart_init)
//--------------------------------------------------------------------------
-
// ValidCtrCheck is used to assure that the components created do not have
// any pure virtual functions.
//

static inline void ValidCtrCheck(TPlacesDialog *)
{
new TPlacesDialog(NULL);
}
//--------------------------------------------------------------------------
-
__fastcall TPlacesDialog::TPlacesDialog(TComponent* Owner)
: TOpenDialog(Owner),
ss(sizeof(OPDFILENAME)),
ourdialogdata((LPOPENFILENAMEA)&opddialogdata)
{
setmem(&opddialogdata,sizeof(opddialogdata),0);
}
BOOL __fastcall TPlacesDialog::TaskModalDialog(void * DialogFunc,
void* DialogData) // override Dialogs::TOpenDialog method
{
((LPOPENFILENAMEA)DialogData)->hInstance =
(void*)FindClassHInstance(this->ClassType());

if(((LPOPENFILENAMEA)DialogData)->lStructSize >
OPENFILENAME_SIZE_VERSION_400)
{
// Here if new (8Cool OPENFILENAME structure in caller
return TCommonDialog::TaskModalDialog(DialogFunc, DialogData);
}
else
// Here if old (76) OPENFILENAME structure in caller
{
opddialogdata.ofn=*((LPOPENFILENAME_NT4A)DialogData);
opddialogdata.ofn.lStructSize=ss;
// Preceeding line causes GetOpenFilename call to fail on Win98 because
// the largeer lStructSize is unknown. TOpenDialog::DoExecute checks the
// Windows version and uses the smaller number when necessary, regardless
// of the actual size of the structure!

// opddialogdata.ofn.Flags&= ~OFN_ENABLEHOOK;
// opddialogdata.ofn.Flags&= ~OFN_ENABLESIZING;
return TCommonDialog::TaskModalDialog(DialogFunc, ourdialogdata);
}
}
//--------------------------------------------------------------------------
-
namespace Placesdialog
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid(TPlacesDialog)};
RegisterComponents("Samples", classes, 0);
}
}
//--------------------------------------------------------------------------
-
--
Timothy H. Buchman
========================================
City Center Theater, New York NY
mail address tbuchmanPLEASE(at sign)REMOVEcitycenter.org
Search .borland message archive on http://www.tamaracka.com/search.htm


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.