过滤器中的字符串(.文件后缀)动态显示在对话框输入框中

高华子 2014-10-15 09:09:20
VC++中的过滤器中的字符串(.文件后缀)动态显示在对话框输入框中呢;也就是在过滤器中的那个文件后缀动态显示在手输入文件名之后
...全文
269 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
高华子 2014-10-20
  • 打赏
  • 举报
回复
为什么没人帮我看一下这个呢,
高华子 2014-10-19
  • 打赏
  • 举报
回复
为啥没人理呢?这个问题很低级吗?
高华子 2014-10-18
  • 打赏
  • 举报
回复
引用 1 楼 zhao4zhong1 的回复:
你的那个C我能看的懂,也会弄,只是到了对话框哪里我就蒙了,我不知道那个对话框了如何动态显示过滤器里的文件名后缀了
赵4老师 2014-10-16
  • 打赏
  • 举报
回复
Filters The information in this section applies to both Explorer-style and old style Open and Save As dialog boxes. You can provide filename filters to assist the user in limiting the filenames that the dialog box displays. A filename filter consists of a pair of null-terminated strings, a description and a pattern, one concatenated to the other. The dialog box displays the description to let the user pick which filter to use; and it uses the pattern to select the files to display. To specify the filters, set the lpstrFilter member of the OPENFILENAME structure to point to a buffer that contains an array of filter string pairs. The last string in the array must be followed by an extra null character. A pattern string can be a combination of valid filename characters and the asterisk (*). The asterisk is a wildcard that represents any combination of valid filename characters. The dialog box displays only those files that match the pattern. To specify multiple patterns for the same description, you must use a semicolon (;) to separate the patterns. Note that space characters in the pattern string can produce unexpected results. The following code fragment specifies two filters. The filter with the "Source" description has two patterns. If the user selects this filter, the dialog box displays only files that have the .C and .CXX extensions. OPENFILENAME ofn; // common dialog box structure ofn.lpstrFilter = "Source\0*.C;*.CXX\0All\0*.*\0" ofn.nFilterIndex = 1; The nFilterIndex member of the OPENFILENAME structure specifies an index that indicates which filter the dialog box initially uses. The first filter in the buffer has index 1, the second 2, and so on. If the user changes the filter while using the dialog box, the nFilterIndex member is set to the index of the selected filter on return. You can create a custom filter by setting the lpstrCustomFilter member to the address of a buffer that contains a single filter, and by setting the nMaxCustFilter member to the size of the buffer, in characters or bytes. The dialog box always places the custom filter at the beginning of the list of filters and, on return, always updates the pattern part of the filter with the pattern from the filter selected by the user. For Explorer-style dialog boxes, the default extension may change if the user selects a different filter. If the user selects a filter whose first pattern is of the form *.xxx (that is, the extension does not include a wildcard character), the dialog box uses xxx as the default extension. This occurs only if you specified a default extension in the lpstrDefExt member of the OPENFILENAME structure. For example, if the user selects the "Source\0*.C;*.CXX\0" filter, the default extension changes to "C". However, if you had defined the filter as "Source\0*.C*\0", the default extension would not change because the extension includes a wildcard.
#include <stdio.h>
char cBuffer[100]="hello\0world\0friend\0";
char *p[100];
int i,n;
void main() {
    n=0;
    p[n]=cBuffer;
    n++;
    for (i=0;i<99;i++) {
        if (0==cBuffer[i]) {
            if (0==cBuffer[i+1]) {
                break;
            } else {
                p[n]=cBuffer+i+1;
                n++;
            }
        }
    }
    for (i=0;i<n;i++) printf("%d [%s]\n",i,p[i]);
}
//0 [hello]
//1 [world]
//2 [friend]

3,882

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧