Path: news.mitre.org!blanket.mitre.org!agate!newsgate.duke.edu!nntprelay.mathworks.com!howland.erols.net!torn!webster.srv.gc.ca!news.NRCan.gc.ca!newsmaster@nrn2.nrcan.gc.ca From: "John A. Grant" Newsgroups: comp.os.ms-windows.programmer.misc,comp.os.ms-windows.win95,comp.os.ms-windows.win95.misc,comp.os.ms-windows.programmer,comp.os.ms-windows.programmer.nt.kernel-mode Subject: Re: GetSaveFileName filter problem Date: Sun, 7 Dec 1997 18:55:26 -0500 Organization: gsc Lines: 31 Message-ID: <66fd17$hhu40@nrn2.NRCan.gc.ca> References: <3486024A.7E8C@netvision.net.il> <3489608C.F130D5E5@ix.netcom.com> <348A81EF.24@swix.ch> NNTP-Posting-Host: jagrant.gsc.emr.ca X-Newsreader: Microsoft Outlook Express 4.71.1712.3 X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3 Xref: news.mitre.org comp.os.ms-windows.programmer.misc:134427 comp.os.ms-windows.win95.misc:290797 comp.os.ms-windows.programmer.nt.kernel-mode:5661 Mete Ciragan wrote in message <348A81EF.24@swix.ch>... >> ofn.lpstrFilter = "Text Files\0*.txt\0" ; > >Hi, try this >ofn.lpstrFilter = "Text Files\0*.txt\0\0\0" ; > >the last line needs to '\0' more. For example: > >ofn.lpstrFilter = "Text Files\0*.txt;*.doc;*.asc\0All Files >(*.*)\0*.*\0\0\0"; >ofn.nFilterIndex = 1; Yes the key is "\0\0" at the end of the string & the nFilterIndex, but you don't need 3 of them, just 2. BTW, I always take advantage of the compiler's ability to concatenate literals and I write these strings as: ofn.lpstrFilter= "Text Files\0" "*.txt\0" "Write Files\0" "*.wri\0" "All files\0" "*.*\0" "0\"; This is not only more readable, it allows you to see how the last "\0" is used to terminate the sequence of string pairs. -- John A. Grant * I speak only for myself * jagrant@znrcan.gc.ca (remove 'z') Airborne Geophysics, Geological Survey of Canada, Ottawa If you followup, please do NOT e-mail me a copy: I will read it here.