Solved

Problem with OpenDialog component: ofEnableIncludeNotify property and IncludeItem event

Posted on 2004-09-01
2
531 Views
Last Modified: 2010-04-04
How to make the event IncludeItem of TOpenDialog work?

I have set the ofEnableIncludeNotify property to true and written this code.......

procedure TForm1.OpenDialog1IncludeItem(const OFN: TOFNotifyEx;
  var Include: Boolean);
begin
 Include:=False;
end;

However, still all files are displayed when I execute the OpenDialog. The above code does get trigerred for every file, but soemhow the Include variable has no effect.

I know it is a bug in Microsoft implementation, (plenty of websites on internet refer to this)........... but does anyone know of a work around?

I am using Delphi 7 on Windows XP. Application deployment would be on Windows 2000 & XP, XP SP1, XPSP2 machines.
0
Comment
Question by:GSPannu
2 Comments
 
LVL 6

Accepted Solution

by:
vadim_ti earned 500 total points
ID: 11956404
It is not exactly what you want, but may be you can apply
filter. In this sample only
a.*
b.*
*.tiff
files will be displayed.


procedure TForm1.Button1Click(Sender: TObject);
var
  ofn:tagOFNA;
  szFile: array [0..260] of char;
begin
  inherited;

FillChar(ofn, sizeof(tagOFNA), 0);
ofn.lStructSize := sizeof(tagOFNA);
ofn.hwndOwner := handle;
ofn.lpstrFile := szFile;
ofn.lpstrFile[0] := #0;
ofn.nMaxFile := sizeof(szFile);
ofn.lpstrFilter := 'My Files'#0'a*.*;b*.*;*.tiff'#0;
ofn.nFilterIndex := 1;
ofn.lpstrFileTitle := nil;
ofn.nMaxFileTitle := 0;
ofn.lpstrInitialDir := nil;
ofn.Flags := OFN_PATHMUSTEXIST or OFN_FILEMUSTEXIST or OFN_EXPLORER ;
  GetOpenFileName(ofn);
end;
0
 

Author Comment

by:GSPannu
ID: 11961670
Dear Vadim,

Thank you for your quick response.

Could you email me (guru.pannu@pri.co.uk) a complete Delphi project (.pas, .dfm, .dpr) explaining what you have just written?

I haven't been able to understand your answer fully.

Thx. Guru
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

803 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