Solved

Problem with OpenDialog component: ofEnableIncludeNotify property and IncludeItem event

Posted on 2004-09-01
2
527 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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now