home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / mswindo / programm / misc / 4386 < prev    next >
Encoding:
Text File  |  1992-12-21  |  2.9 KB  |  86 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!mcsun!sunic!aun.uninett.no!ugle.unit.no!ugle.unit.no!torstein
  3. From: torstein@itekiris.kjemi.unit.no (torstein hansen)
  4. Subject: Re: Borland-izing Common Dialogs
  5. In-Reply-To: jeff@tct.com's message of Fri, 18 Dec 1992 16:26:07 GMT
  6. Message-ID: <TORSTEIN.92Dec21103132@itekiris.kjemi.unit.no>
  7. Sender: news@ugle.unit.no (NetNews Administrator)
  8. Organization: Dept. of Chem.Eng, Norwegian Inst. of Tech
  9. References: <2B31FB9F.88D4@tct.com>
  10. Date: 21 Dec 92 10:31:32
  11. Lines: 73
  12.  
  13. In article <2B31FB9F.88D4@tct.com> jeff@tct.com (Jeff Witzer) writes:
  14.    I'm writing an app that uses Borland style dialog boxes and buttons.  I
  15.    would like to keep the interface consistant but haven't found a way to 
  16.    Borland-ize the <commdlg> File Save and File Open dialog boxes.
  17.  
  18.    Does Borland have their own version?  (I couldn't find any public alternative
  19.    like thier BWCCMessageBox...I hoped to find a BWCCGetOpenFileName () and 
  20.    BWCCGetSaveFileName ())
  21.  
  22.    I also tried to run Resource Workshop on my .exe but, of course, couldn't find
  23.    those dialogs to modify.
  24.  
  25.    Should I give up and use the bland MicroSoft standard dialogs or is there hope?
  26.  
  27.    jeff@tct.com
  28.  
  29. There sure is hope...
  30.  
  31. In Borland Pascal for Windows you would do something like this:
  32. (Shouldn't be to different from C should it?)
  33.  
  34. var
  35.   ofn         : TOpenFileName;
  36.   DialogHandle: THandle;
  37.   .
  38.   .
  39.  
  40. begin
  41.   DialogHandle:=loadResource(hInstance,
  42.                   FindResource(hInstance,pchar(dialog_id),rt_dialog));
  43.   .
  44.   .
  45.   with ofn do begin
  46.     {other initialisations}
  47.     hInstance:=DialogHandle;
  48.     Flags:=....or ofn_EnableHook or ofn_EnableTemplateHandle;
  49.     lpfnHook:=FileDlgHook;
  50.   end;
  51.  
  52. where FileDlgHook is the adress of your custom dialog handling
  53. function. All messages would now go to this function before
  54. COMMDLG.DLL get its hands on them. Do whatever you want and return 1
  55. if you have handled a message, and zero if not. 
  56.  
  57. BTW.  I: in this example I have copied the dialog resource from
  58. COMMDLG.DLL to my executable and given it an id of dialog_id.
  59. pchar(dialog_id) is just a typecast equivalent to the winAPI's
  60. MakeIntResource. 
  61.  
  62. BTW. II: If there are enough interest I might do some refinement on my
  63. code and put it up on Garbo, or some other ftp-site. At present it
  64. uses X-windows-like listboxes with 3-dimentional selection
  65. highlightning, but that may easily be ruled out. If there are any
  66. interest, please email me, and state if you would like it to be in
  67. either Pascal or C, as a linkable unit or as a standalone DLL
  68. (whatever that is?)
  69.  
  70. BTW III: If a user selects (in an open file dialog box) a non-existent
  71. file, COMMDLG.DLL puts up a warning message box.
  72.  How can I intercept this? (to make a 3-dim box instead)
  73.  Should I take care of this myself?
  74.  Do I even have to bother?
  75.  Who am I?
  76.  Why am I here?
  77.  
  78. Good luck
  79.  
  80. Torstein
  81.    
  82.     
  83. --
  84. Torstein Hansen
  85. torstein@itekiris.kjemi.unit.no
  86.