## CFileDialog causes application to Hang on Windows 2000

VC

### Next

• 1. Capturing Key Presses in CPropertyPage
I've got a Property Sheet with several Property Pages. I want hitting the Escape key to call the OnCancel() function, and I want hitting the Enter key to call the OnOK() function, just like in a normal dialog. I tried capturing the WM_KEYDOWN in the Property Page, but I didn't ever catch anything.
• 2. Who could recommend me an article about class CListView?
Hello all: I want to know well the class CListView in detail, such as style,extended style,and message,and so on, Who could recommend me an article about class CListView? Thank you very much.
• 3. Does anybody know how to use the WinAPI funcitons to proccess a message of MIDI Keyboard?
as the subject
• 4. FindFirstFile() problem. Need Help!!! THANKS!!!
When i run code below: WIN32_FIND_DATA FileData; HANDLE hFile = FindFirstFile("\\HardDisk\\be\\bin\\setting\\1.dat", &FileData); DWORD r = GetLastError(); error value r return #3 ERROR_PATH_NOT_FOUND. But when i run code in another class the hFile will return OK. The calss we use is a base class, each Dialog will public from this base class "CBaseDlg.h" CBaseDlg(UINT nIDTemplate, CWnd* pParentWnd); virtual ~CBaseDlg(); "CBaseDlg.cpp" CBaseDlg::CBaseDlg(UINT nIDTemplate, CWnd* pParentWnd) { AFX_ZERO_INIT_OBJECT(CWnd); m_pParentWnd = pParentWnd; m_lpszTemplateName = MAKEINTRESOURCE(nIDTemplate); m_nIDHelp = nIDTemplate; } CBaseDlg::~CBaseDlg() { } Others public from this base class CAnotherDlg::CAnotherDlg(CWnd* pParent /*=NULL*/) : CBaseDlg(CAnotherDlg::IDD, pParent) I can not use FindFIrstFile() in CBaseDlg class but use it OK in CAnotherDlg. Why will lead to this problem? thanks!!

### CFileDialog causes application to Hang on Windows 2000

I have developed an application using VC 7.1.
In this application a call to CFileDialog::DoModal() causes the application
to hang and never return.
It happens on random machines. I have tested it on different machines and it
doesn't hang on some of the machines but it hangs on others.

After debugging I've found that the application hangs on a call to
GetSaveFileName() function within the DoModal function.

What is the reason for it and whats the work around?

Thanks,
Faisal



### RE: CFileDialog causes application to Hang on Windows 2000

You may need to provide more info, context of how the code is called, what
parameters you pass in, where the dialog is set to initialise to exactly
(full path) is it network or local, does it repro if you adjust any of the
aformentioned parameters.

Andy Mortimer [MS]
Please do not send email directly to this alias. This alias is for
newsgroup purposes only

This posting is provided "AS IS" with no warranties, and confers no rights.
included script samples are subject to the terms specified at
http://www.**--****.com/ "



### Re: CFileDialog causes application to Hang on Windows 2000

While running have you checked the value of sizeof(OPENFILENAMEW)...?  What
was the result?

Rail
--
Recording Engineer/Software Developer
Rail Jon Rogut Software
http://www.**--****.com/
mailto: XXXX@XXXXX.COM



### Re: CFileDialog causes application to Hang on Windows 2000

This is how I am using it
CFileDialog fileDialog(FALSE, _T("csv"), NULL,
OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST, NULL, this, sizeof(OPENFILENAME));

if (fileDialog.DoModal() ==IDOK )

{

UpdateData(TRUE);

m_strOutputFileName = fileDialog.GetPathName();

UpdateData(FALSE);

}

I also tried by providing NULL in place of sizeof (OPENFILENAME), but it
still hangs.

Thanks,

Faisal

rights.



### Re: CFileDialog causes application to Hang on Windows 2000

Have you checked the versions of comctl32.dll on your problematic PC's?

Andy Mortimer [MS]
Please do not send email directly to this alias. This alias is for
newsgroup purposes only

This posting is provided "AS IS" with no warranties, and confers no rights.
included script samples are subject to the terms specified at
http://www.**--****.com/ "



### Re: CFileDialog causes application to Hang on Windows 2000

Following is the version info for comctl32.dll on probelmatic PC:

File Version: 5.81.4916.400
Product Version: 5.50.4916.400

Please suggest, my client needs the 'Browse' button to work on his system :)



### Re: CFileDialog causes application to Hang on Windows 2000

You might want to try adjusting the value of  _WIN32_WINNT inside stdafx.h
to see if that has any effect.

Andy Mortimer [MS]
Please do not send email directly to this alias. This alias is for
newsgroup purposes only



### Re: CFileDialog causes application to Hang on Windows 2000

I tried adjusting that too. The default value I believe is 0x0500, which I
believe is for windows 2000, I changed to 0x0400 but the application still
hangs, also tried with 0x0600, but then I started having compile time errors,
like:

C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\include\afxwin.h(3289): error C2061: syntax error :
identifier 'PSCROLLBARINFO'
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\include\afxwin4.inl(148): error C2065: 'PSCROLLBARINFO' :
undeclared identifier
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\include\afxwin4.inl(148): error C2146: syntax error : missing
')' before identifier 'pScrollInfo'
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\include\afxwin4.inl(148): error C2761: 'BOOL
CScrollBar::GetScrollBarInfo(void) const' : member function redeclaration not
allowed
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\include\afxwin4.inl(148): error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\include\afxwin4.inl(149): error C2143: syntax error : missing
';' before '{'
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\include\afxwin4.inl(149): error C2447: '{' : missing function

Can you guide me here?

I think ( I am not sure ) this occurs only with Windows 2000 and IE6
combination. Would it help in identifying the problem?

Thanks,
Faisal



### Re: CFileDialog causes application to Hang on Windows 2000

What is it about the PC's that fail? Do the folders contain lots of files,
or files which are huge, long filenames etc? Perhaps do some analysis into
what is different in working and non working scenarios. Also, you could use
filemon utility from sysinternals.com to see if files are actually being
accessed. Also can review
http://www.**--****.com/ ;EN-US;Q286350 in order to
use adplus to create a hang dump of the problem and analyse the stacks.



### Re: CFileDialog causes application to Hang on Windows 2000

Finally, I managed to fix this bug...well not completely but it is now working.

The reason being for not working on some of the windows 2000 machines was:
That I was giving 'null' for the lpszFilter parameter. That should mean there
is no filter. But this gives trouble with some of the Windows 2000 machines.

Again, if I give some filter, other than '*.*', it still gives trouble.

So, During Hit and Trial, I found that it works well on all the windows 2000
machines only if I give a single filter of *.*

Do you have any idea about the issue? Is this a known issue or what? Is
there a work around?

Thanks,
Faisal



### Re: CFileDialog causes application to Hang on Windows 2000

Remember that the filter string should be double zero-terminated.



### Re: CFileDialog causes application to Hang on Windows 2000

Indeed. Note the remarks section:-

Remarks
The lpszFilter parameter is used to determine the type of filename a file
must have to be displayed in the file list box. The first string in the
string pair describes the filter; the second string indicates the file
extension to use. Multiple extensions may be specified using a semicolon
(;) as the delimiter. The string ends with two vertical bar (||)
characters, followed by a NULL character. You can also use a CString object
for this parameter.

For example, Microsoft Excel permits users to open files with extensions
.XLC (chart) or .XLS (worksheet), among others. The filter for Excel could
be written as:

static char BASED_CODE szFilter[] = "Chart Files (*.xlc)|*.xlc|Worksheet
Files (*.xls)|*.xls|Data Files (*.xlc;*.xls)|*.xlc; *.xls|All Files
(*.*)|*.*||";
Note, however, that if you plan to use this string to directly update the
OPENFILENAME structure, you should delimit your strings with the null
character, (\0), instead of the vertical bar (|).



Hello,

I have an application written in VisualStudio C++ .NET 2003 which use both
managed and MFC code (the managed code is for XML) that hangs when a
CFileDialog is created in a Windows 2000 machine. In my development machine
(Windows XP) the app works fine, both debug and release version.
To isolate if this is a kind of bug in my app I generate a simple SDI app
using the wizard and add the same code that creates the CFileDialog. This app
works in the Windows 2000 machine, the file dialog works as it should.

So I tried to debug my app in the W2K machine using WinDbg and I got this
output:

(2d0.64c): Unknown exception - code 000006f4 (first chance)

I wonder if this could mean something to anyone
I appreciate any help on this topic.

Thanks!



Hello,

I have extended the CFileDialog class so I can select Folders instead of
just
Files.

When I send the CDM_GETSPEC message to get the currently selected item, I
get the correct folder when I test with Windows XP. However, when I run my
app on Wndows 2000, DM_GETSPEC returns an empty string (""). Also, sending
of the CDM_GETFILEPATH message works as desired for XP, but only returns the
parent folder in 2000.

Any help would be much appreciated.

-Neil