🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #1680

Re: Borland-izing Common Dialogs

#1680
From: torstein hansen
Date: Mon, 21 Dec 1992 10:31
73 lines
3018 bytes
In article <2B31FB9F.88D4@tct.com> jeff@tct.com (Jeff Witzer) writes:
   I'm writing an app that uses Borland style dialog boxes and buttons.  I
   would like to keep the interface consistant but haven't found a way to 
   Borland-ize the <commdlg> File Save and File Open dialog boxes.

   Does Borland have their own version?  (I couldn't find any public alternative
   like thier BWCCMessageBox...I hoped to find a BWCCGetOpenFileName () and 
   BWCCGetSaveFileName ())

   I also tried to run Resource Workshop on my .exe but, of course, couldn't find
   those dialogs to modify.

   Should I give up and use the bland MicroSoft standard dialogs or is there hope?

   jeff@tct.com

There sure is hope...

In Borland Pascal for Windows you would do something like this:
(Shouldn't be to different from C should it?)

var
  ofn         : TOpenFileName;
  DialogHandle: THandle;
  .
  .

begin
  DialogHandle:=loadResource(hInstance,
                  FindResource(hInstance,pchar(dialog_id),rt_dialog));
  .
  .
  with ofn do begin
    {other initialisations}
    hInstance:=DialogHandle;
    Flags:=....or ofn_EnableHook or ofn_EnableTemplateHandle;
    lpfnHook:=FileDlgHook;
  end;

where FileDlgHook is the adress of your custom dialog handling
function. All messages would now go to this function before
COMMDLG.DLL get its hands on them. Do whatever you want and return 1
if you have handled a message, and zero if not. 

BTW.  I: in this example I have copied the dialog resource from
COMMDLG.DLL to my executable and given it an id of dialog_id.
pchar(dialog_id) is just a typecast equivalent to the winAPI's
MakeIntResource. 

BTW. II: If there are enough interest I might do some refinement on my
code and put it up on Garbo, or some other ftp-site. At present it
uses X-windows-like listboxes with 3-dimentional selection
highlightning, but that may easily be ruled out. If there are any
interest, please email me, and state if you would like it to be in
either Pascal or C, as a linkable unit or as a standalone DLL
(whatever that is?)

BTW III: If a user selects (in an open file dialog box) a non-existent
file, COMMDLG.DLL puts up a warning message box.
 How can I intercept this? (to make a 3-dim box instead)
 Should I take care of this myself?
 Do I even have to bother?
 Who am I?
 Why am I here?

Good luck

Torstein
   
    
--
Torstein Hansen
torstein@itekiris.kjemi.unit.no
Technical Details
Message-ID: <TORSTEIN.92Dec21103132@itekiris.kjemi.unit.no>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!aun.uninett.no!ugle.unit.no!ugle.unit.no!torstein
References: <2B31FB9F.88D4@tct.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!aun.uninett.no!ugle.unit.no!ugle.unit.no!torstein
From: torstein@itekiris.kjemi.unit.no (torstein hansen)
Subject: Re: Borland-izing Common Dialogs
In-Reply-To: jeff@tct.com's message of Fri, 18 Dec 1992 16:26:07 GMT
Message-ID: <TORSTEIN.92Dec21103132@itekiris.kjemi.unit.no>
Sender: news@ugle.unit.no (NetNews Administrator)
Organization: Dept. of Chem.Eng, Norwegian Inst. of Tech
References: <2B31FB9F.88D4@tct.com>
Date: 21 Dec 92 10:31:32
Lines: 73