在Windows 10操作系统中从CFileDialog(VC ++)的打开文件对话框中遇到问题 [英] Encountered an issue in open file dialog from CFileDialog (VC++) in windows 10 OS

查看:322
本文介绍了在Windows 10操作系统中从CFileDialog(VC ++)的打开文件对话框中遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Team,



我使用visual studio 2008作为IDE进行vc ++开发,最近我将系统从Windows 7 OS升级到Windows 10。 当我的Visual Studio处于调试模式时,我在打开文件对话框中遇到一个奇怪的问题,我有源代码,
执行文件选择并基于CFileDialog msdn类,它曾经在Windows 7操作系统上运行,其中as在Windows 10中,当我运行我的应用程序并单击按钮进行文件选择时; Windows UI挂起并且不响应,并且不显示要选择的
文件集。要阻止这种情况,我必须停止调试我的代码,这是我发现的可能方式。我检查了微软论坛,并了解到许多开发人员在Windows 10中遇到了打开文件对话框的问题。它是一个向后兼容的情况,
请解决它,如果它有问题或有任何修复,请按照明确的步骤建议修复。 



问候委员b
Ravikiran Desai



当前VS 2008版本:

9.0.30729.1 SP



void CxxxxxDlg :: OnBnClickedButtonActivateScenario()

{

// TODO:在此处添加您的控制通知处理程序代码

CWnd pParent;

CString pathFileName;

< span style ="white-space:pre"> CString fileName =" *" ;;

CString fFilter ,extension,temp;

CString title =" Open Script File"; $
int ok = -1;

CScenarioCompiler * aCompiler;

CScenarioScript * aScenario = NULL;

CString warning = ",",err ="" ;;
$


fFilter ="脚本文件(*。*)| *。* ||" ;;

extension ="" ;;

尝试
{

CFileDialog fileDlg(TRUE,NULL,fileName + extension,

/ * OFN_ALLOWMULTISELECT | * / OFN_HIDEREADONLY | OFN_EXPLORER | OFN_ENABLETEMPLATE,

fFilter,this-> GetWindow(GW_OWNER),0,FALSE);

fileDlg.m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_CUSTOM_FILE_DLG);

fileDlg.m_ofn.lStructSize = sizeof(OPENFILENAME);

fileDlg.m_ofn.lpstrTitle = title;

fileDlg.m_ofn.hwndOwner = this-> m_hWnd;

if(fileDlg.DoModal()== IDOK)

{



  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // *********** *********
$


  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // Windows UI挂起,无法选择文件



pathFileName = fileDlg.GetPathName ();
$




$

解决方案

你好,


我认为你也应该升级你的VS.当VS 2008发布时,Windows 10不存在。


很多年前,我也只将Windows系统从XP改为Win 7,并且在CFileDialog方面遇到了同样的问题。升级VS解决了这个问题。


使用VS 2017代替。 https://visualstudio.microsoft.com/downloads/


此致,Guido


Hi Team,

I work on vc++ development using visual studio 2008 as IDE, I recently upgraded my system to windows 10 from windows 7 OS.  I have encountered a strange issue in open file dialog when my Visual studio is in debug mode, I have source code which does a file selection and based on CFileDialog msdn class, which used to work on Windows 7 OS, where as in windows 10, when i run my application and click on a button to do file selection; windows UI hangs and doesn't respond and doesnot display the set of files to be selected. To stop this I have to stop debugging my code that's the possible way i found. I checked the microsoft forums and came to know that many developers face the issue of open file dialog in windows 10. Its a case of backward compatibility, Please resolve it if its an issue or if there is any fix for it, please suggest the fix with clear steps. 

Regards
Ravikiran Desai

Current VS 2008 version:
9.0.30729.1 SP

void CxxxxxDlg::OnBnClickedButtonActivateScenario()
{
// TODO: Add your control notification handler code here
CWnd pParent;
CString pathFileName;
CString fileName = "*";
CString fFilter,extension,temp;
CString title="Open Script File";
int ok=-1;
CScenarioCompiler* aCompiler;
CScenarioScript *aScenario=NULL;
CString warning="",err="";

fFilter = "Script file (*.*)|*.*||";
extension = "";
try
{
CFileDialog fileDlg(TRUE, NULL, fileName + extension,
/*OFN_ALLOWMULTISELECT | */ OFN_HIDEREADONLY | OFN_EXPLORER | OFN_ENABLETEMPLATE,
fFilter, this->GetWindow(GW_OWNER), 0, FALSE ) ;
fileDlg.m_ofn.lpTemplateName = MAKEINTRESOURCE( IDD_CUSTOM_FILE_DLG ) ;
fileDlg.m_ofn.lStructSize = sizeof (OPENFILENAME) ;
fileDlg.m_ofn.lpstrTitle = title ;
fileDlg.m_ofn.hwndOwner = this->m_hWnd;
if (fileDlg.DoModal () == IDOK)
{

                       //*******************************************************

                        //windows UI hangs here and not able to select a file

pathFileName = fileDlg.GetPathName();




解决方案

Hello,

I think you should also upgrade your VS. When VS 2008 was released, Windows 10 didn't exist.
Many years ago, I also only changed the Windows System from XP to Win 7 and had same problems with CFileDialog. Upgrading the VS solved the problem.

Use VS 2017 instead. https://visualstudio.microsoft.com/downloads/

Regards, Guido


这篇关于在Windows 10操作系统中从CFileDialog(VC ++)的打开文件对话框中遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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