Article View: borland.public.cppbuilder.nativeapi
Article #9350Problems trying to use the 'own filtering' function of WinXP for GetOpenFilename() (using OFN_ENABLEINCLUDENOTIFY)
From: MR
Date: Sat, 17 Jul 2004 18:33
Date: Sat, 17 Jul 2004 18:33
63 lines
2742 bytes
2742 bytes
Trying to use the 'own filtering' function of WinXP, I get two
problems
The main snippet was
OPENFILENAME ofn;
memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize=sizeof(OPENFILENAME);
char filename[_MAX_PATH]=""/*init filename*/;
ofn.lpstrFile=filename; // this is a must
ofn.nMaxFile=sizeof(filename);
ofn.Flags=OFN_ENABLEHOOK|OFN_EXPLORER|OFN_ENABLEINCLUDENOTIFY;
ofn.lpfnHook=(LPOFNHOOKPROC)OFNHookProc;
if(GetOpenFileName(&ofn)==FALSE) {
...
}
which OFN_ENABLEINCLUDENOTIFY flag calls (on XP) the OFNHookProc
procedure with the expectation it handles
UINT APIENTRY OFNHookProc(
HWND hdlg, // handle to child dialog window
UINT uiMsg, // message identifier
WPARAM wParam, // message parameter
LPARAM lParam // message parameter
) {
switch(uiMsg) {
case WM_NOTIFY: {
LPOFNOTIFYEX lpon = (LPOFNOTIFYEX)lParam;
if(lpon->hdr.code==CDN_INCLUDEITEM) {
return(ShouldBeIncluded(lpon)); // BREAKPOINT
}
}
return(0); // default handler processes message
}
Doing a breakpoint at the BREAKPOINT-position of OFNHookProc()
the debugger really stops for each file in the directory.
1)
Unfortunately I did not come any further, i.e. I had no success
evaluating lpon such, that I get the filename. Perhaps someone knows
how to extract it from LPOFNOTIFYEX.
2)
Creating a function ShouldBeIncluded(), which always returns false
bool ShouldBeIncluded(LPOFNOTIFYEX lpon)) {
return(false);
}
strangely results in a open-file-box which also displays all the
files. (Same result as if ShouldBeIncluded() always returns true.) I
found a interness-information that this self-filtering will only work
for non-system-directories, but the directory I run through is
something like o:\demo and such definitively no such dir.
Any ideas?
Thanks a lot,
Michael
Technical Details
Message-ID:
<11rif0dmrj7e9pt8id4qh839jdrrkh7kt7@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ff48c87a2e0fa727,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: M_R <> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Problems trying to use the 'own filtering' function of WinXP for GetOpenFilename() (using OFN_ENABLEINCLUDENOTIFY) Date: Sat, 17 Jul 2004 20:33:55 +0200 Message-ID: <11rif0dmrj7e9pt8id4qh839jdrrkh7kt7@4ax.com> X-Newsreader: Forte Free Agent 2.0/32.646 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 83.129.163.212 X-Trace: newsgroups.borland.com 1090089234 83.129.163.212 (17 Jul 2004 11:33:54 -0700) Lines: 65 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail