Windows 7的cfiledialog [英] cfiledialog for windows 7

查看:151
本文介绍了Windows 7的cfiledialog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用vs 2008作为我的程序,应该可以在winxp,vista,win7中运行...
cfiledialog具有最后一个参数bVistaStyle,应将其设置为true
用于Vista样式对话框

并且文档还说ApplyOFNToShellDialog();函数在domodal()和
中调用 UpdateOFNFromShellDialog();好的

我用
编译程序 #define WINVER 0x0501
#define _WIN32_WINNT 0x0501

但是函数ApplyOFNToShellDialog()和UpdateOFNFromShellDialog()的声明
是否在编译器内部,如果块
#if WINVER> = 0x0600

.....
#endif

并且我的程序仍然可以正确编译.为什么?
WINVER的目的还在于设置应用程序可以运行的最低版本,并将其保持在WINVER>中. = 0x0600错误
因为要在winxp上使用的程序也要在其他任何更高版本上使用.

i m using vs 2008 for my program which should work in winxp,vista,win7 ...
cfiledialog has a last parameter bVistaStyle which should be set to true
for vista style dialog

and also the doc says that the ApplyOFNToShellDialog(); function is called in domodal() and
UpdateOFNFromShellDialog(); in ok

and i compiling my program with
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501

but the declarations of function ApplyOFNToShellDialog() and UpdateOFNFromShellDialog()
are inside the compiler if block
#if WINVER >= 0x0600

.....
#endif

and still my programme is compiling properly.why?
and also the purpose of WINVER is setting the minimum version on which the application should work and keeping it in WINVER > = 0x0600 is wrong
because a program meant to work on winxp is also meant on any other higher verions

推荐答案

CFileDialog 构造函数调用GetVersionEx 以确定当前的OS版本.如果将Vista样式设置为TRUE,并且该应用程序在Vista之前的操作系统中运行,它将将该标志重置为FALSE.

至于代码编译,除非您明确尝试调用未针对您的版本定义的方法,否则它将进行编译.操作系统的实际确定是运行时行为.
The CFileDialog constructor calls GetVersionEx to determine the current OS version. If you set the vista style to TRUE, and the app is running in a pre-Vista OS, it will reset the flag to FALSE.

And as to your code compiling, unless you explicitly try to call a method not defined for your version, it will compile. This actual determination of the OS is a runtime behavior.


这篇关于Windows 7的cfiledialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆