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


0
fyesoft (2)
11/25/2004 3:35:49 PM
vc.mfc 33608 articles. 0 followers. Follow

11 Replies
845 Views

Similar Articles

[PageSpeed] 50

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. 
OR if you wish to include a script sample in your post please add "Use of 
included script samples are subject to the terms specified at 
http://www.microsoft.com/info/cpyright.htm" 


0
andmort (67)
11/26/2004 2:31:59 PM
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.railjonrogut.com
      mailto:rail@railjonrogut.com

"Faisal Yaqoob" <fyesoft@hotmail.com> wrote in message 
news:OkfTTSw0EHA.2540@TK2MSFTNGP09.phx.gbl...
>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
>
> 


0
railro (128)
11/26/2004 6:40:43 PM
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.

Please help.

Thanks,

Faisal

"Andy Mortimer [MS]" <andmort@online.microsoft.com> wrote in message
news:f5eKzS80EHA.3388@cpmsftngxa10.phx.gbl...
> 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.
> OR if you wish to include a script sample in your post please add "Use of
> included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm"
>
>


0
fyesoft (2)
11/29/2004 1:12:15 PM
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. 
OR if you wish to include a script sample in your post please add "Use of 
included script samples are subject to the terms specified at 
http://www.microsoft.com/info/cpyright.htm" 


0
andmort (67)
12/2/2004 11:33:00 AM
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 :)

"Andy Mortimer [MS]" wrote:

> 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. 
> OR if you wish to include a script sample in your post please add "Use of 
> included script samples are subject to the terms specified at 
> http://www.microsoft.com/info/cpyright.htm" 
> 
> 
> 
0
Yaqoob (1)
12/21/2004 2:03:02 PM
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

0
andmort (67)
12/21/2004 3:31:50 PM
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 
header (old-style formal list?)

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


"Andy Mortimer [MS]" wrote:

> 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
> 
> 
0
12/22/2004 1:01:01 PM
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://support.microsoft.com/default.aspx?scid=kb;EN-US;Q286350 in order to 
use adplus to create a hang dump of the problem and analyse the stacks.

0
andmort (67)
12/22/2004 1:34:04 PM
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

"Andy Mortimer [MS]" wrote:

> 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://support.microsoft.com/default.aspx?scid=kb;EN-US;Q286350 in order to 
> use adplus to create a hang dump of the problem and analyse the stacks.
> 
> 
0
12/28/2004 8:05:01 AM
Remember that the filter string should be double zero-terminated.

"Faisal Yaqoob" <FaisalYaqoob@discussions.microsoft.com> wrote in message 
news:73150BB6-33E2-496C-ACF9-06C896615BDA@microsoft.com...
> 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
>
> "Andy Mortimer [MS]" wrote:
>
>> 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://support.microsoft.com/default.aspx?scid=kb;EN-US;Q286350 in order 
>> to
>> use adplus to create a hang dump of the problem and analyse the stacks.
>>
>> 


0
alegr (1131)
12/28/2004 8:43:45 PM
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 (|).

0
andmort (67)
1/5/2005 3:26:41 PM
Reply:

Similar Artilces:

Switch to PDF causes format problems
I have created a publication using Publisher 2003. Everything is fine if I print directly from the publication but I encounter problems when I save the document as a PDF for e-mail purposes. Visually the e-mailed document looks fine but when printing from the e-mail the document now shows a non-existent border around one picture and changes the color of another picture. I've also tried saving doc as MDI but have the same problem. -- Help Please Are you using Acrobat? Are you printing to the PDF printer? I only ask because with Acrobat you cannot save, you can only print. Where...

Embedding Visio in .net based Windows Forms Application
Hello, I am using Visual studio.net to programmitically control Visio 2003. I read some of the MSDN articles about this topic and trying to develop some small sample programs. I got some sample program devloped in VB 6.0 that just opens Visio document with basic diagrams template with Basic shapes and then adds Rectangle shape to the drawing and then sets the text to "HELLO WORLD". so The VB code to achecive this task is as follows. Sub HelloWorld () 'Instance of Visio Dim appVisio As Visio.Application 'Documents collection of instance Dim docsOb...

Variables causing macro problems
I'm fairly new to writing macros, so this may be easy. I have a macro with defined variables from the excel worksheet. The variable changes as the macro is run. For instance, when the macro begins the variable may equal 1, but halfway through the macro (after actions have been performed) the variable now equals 5. In the middle of my macro (after the cell value has already changed to 5) I want the variable to be read as 5, not the original 1, because the next portion of actions is different based on the number of that variable. This does not happen. Apparently Excel reads all variabl...

Using Windows fax console
I have used the Windows fax console for receiving faxes for a while. I had Photoshop installed when I started using the fax system in Windows. I could VIEW and it would open Photoshop automatically. I deleted Photoshop and now have Photoshop Essentials 8. I now cannot VIEW anything because I don't have software to view .tif . I know that Essentials opens it, but I can't find anywhere in the fax console to tell it to go to Essentials. Please help. -------- Original-Nachricht -------- > I have used the Windows fax console for receiving faxes for a whil...

ID of CFileDialog
Hi all, i am trying to find Resource ID of CFileDialog, what number is it? i can know this? Let me know if you can help me. Thanks Duy It is not a resource in your project. The dialog is created by Windows when you call GetOpenFileName / GetSaveFileName. -- Sheng Jiang Microsoft MVP in VC++ "James Duy Trinh" <vietdoor@gmail.com> wrote in message news:eOrRoVReIHA.1212@TK2MSFTNGP05.phx.gbl... > Hi all, > > i am trying to find Resource ID of CFileDialog, what number is it? i can > know this? > > Let me know if you can help me. Thanks > > Duy > ...

ShellExecuteEx in case of a multiple document application
Hi! I have to launch applications of my program and listening to its end. During launch I copy data to a temporary file, user can edit the data and when he closed the application I have to copy data back to the database if it had changed. I use ShellExecuteEx to obtain the handle of the App. My problem is to some program after launched, can treat more document and I receive a value of 0 (zero) as a process handle after the first call (because process launching did not hapend). How can I get information to editing my temporary files had finished? Thank you for any help. Imre >I have...

can't open microsoft publisher 2000
unable to open microsoft publisher 2000. need to repair. Re-load from your Publisher 2000 CD.. "mybunch" <mybunch@discussions.microsoft.com> wrote in message news:2EBCC966-E4B8-4319-B61B-3004923990DF@microsoft.com... > unable to open microsoft publisher 2000. need to repair. Specifically what is the problem? Are you getting an error message? What does it say? Exactly what are you doing - opening a file from Explorer or starting from the icon? -- JoAnn Paules MVP Microsoft [Publisher] "mybunch" <mybunch@discussions.microsoft.com> wrote in messag...

Crash using CFileDialog
Hi I am using VS6, SP6, XP-SP1 using MFC as dynamic DLL. I am having a crash when using CFileDialog. Searching net revealed that there is a bug in CFiledialog, but that was fixed in SP6. Crash occurs in destructor of CFileDialog. Can you please guide me to some quick Fix. -- Best regards Shrishail Rana Was the class used as a base class in another class? How did you initalize the CFileDialog class? Directly as ususal. The same code was working properly when MFC was used as static link library. -- Best regards Shrishail Rana CFileDialog fileDlg(TRUE, NULL, NULL, OFN_HIDERE...

Switching to design mode causes VS 2008 to freeze.
When I'm working on a web project and switch a page from source to design mode, VS hangs. Anybody have any thoughts? This doesn't appear to project specific - just that's it's a web page (.aspx) when it happens. TIA - Jeff. ...

Suspect the corrupted company db cause an error when delete/create GP user on another db
In this SQL2000 instance, there are 3 company databases (WSSB, TWSSB and ZZZ) and also is has DYNAMICS. WSSB -- Live company db TWSSB -- Training db ZZZ -- Testing db Logon GP with sa to WSSB, and then GP9 >> Tools >> Setup >> System >> Users then delete a user account and error prompted - is related to stored procedure missing on "another" db named ZZZ. I feel weird so then I try to change company to ZZZ, and the similar error prompted - is related to missing stored procedure on ZZZ db. And I do not successfully logon to ZZZ. So, I wonde...

Calling a non-microsoft application
(1) How can I run a non-microsoft application from Access? (2) Is there a way to show that non-microsoft application inside a control? My guess is that this control would be similar to the Access image viewer (application viewer?) Thanks in advance Question #1 = Shell Function Runs an executable program and returns a Variant (Double) representing the program's task ID if successful, otherwise it returns zero. Syntax = Shell(pathname[,windowstyle]) Query your Access Help to learn more about this function. "Jess" wrote: > (1) How can I run a non-micro...

NT 4 and Windows 2008 Upgrade
I have NT 4 domain and a seperate 2003 AD domain, with trusts between, both ways. I am upgrading my DC's to 2008 presently but I get a message about breaking NT trusts when running dcpromo - and am afraid to continue. Can someone tell me for sure what I need to do to ensure that it works after I'm done? I've read http://support.microsoft.com/kb/942564 and it seems like this would work, and also http://support.microsoft.com/?id=889030 which again should work, but I need a definitive answer so I'm hoping one of the MVP's can assist! I know someone knows the ...

Reminders cause Outlook 2003 to crash
I have a user that had this start this week. For now I have turned off reminders. I have tried /cleanreminders and have tried shutting off the chime based on a post I saw on the web. They are running Vista. Any other ideas? ...

Problems with my Dell Inspion with Windows Vista.
Two months ago, my computer was so full of viruses that it had asked me when I was restarting it if I wanted to restore it back to before I was having all of the problems that I was having with it. After I agreed to restoring it, everything worked fine. Two weeks ago, my computer started making me find the files of things I wanted to open before I opened them, example, if I wanted to open Firefox, an Open With pop up would open and would make me go into files and open it manually. But for some reason, it will not open programs period. How can I fix this without completely re-form...

Multiple Browser Windows
Just recently, when clicking a hyperlink in some of the e-mail I recieve, the brower, IE6, will open up two browser windows. One window will be completely blank, the other will of course load the web page I was linking to. I'm not sure if anyone else has encountered this problem, and I didn't see any postings regarding this issue, but any help that you can provide would be greatly appreciated. I am using Outlook 2000, Windows XP Pro, IE6. ...

CFileDialog
Windows 7 has changed the rules for the member lpstrInitialDir of CFileDialog to: 1. If lpstrInitialDir has the same value as was passed the first time the application used an Open or Save As dialog box, the path most recently selected by the user is used as the initial directory. I want to be able to set the path to what I want not what the first time it was used was. Is there a way to do this? Thank you, Tim ...

Application.DisplayAlerts = False
I'm trying to make it so when I do a "saveas", the computer won't ask m "are you sure you want to overwrite?" The problem is.. I'm loading the excel sheet on internet explorer, an it's not working in this case. Anyone have any tips -- Message posted from http://www.ExcelForum.com ...

some funny characters cause error
Hi, I found one error when exec my store procedrue: Microsoft OLE DB Provider for SQL Server error '80040e14' Unclosed quotation mark after the character string '��l��Y'. I think it's some character cause the error, how to make sure can pass whole string over? Thanks. Hi As I understand that value is not supplied as a parameter to the SP. You do some manipulation within a sp? <someone@js.com> wrote in message news:OjdgQMCzKHA.264@TK2MSFTNGP05.phx.gbl... > Hi, > > I found one error when exec my store procedrue: > Microso...

Unable to open Money 2000
I am unable to open Money 2000!! I am receiving the following error message "MSMoney caused an invalid page fault in module MSVCRT.DLL at 0167:78012cbc. Is anyone able to help? I am using Windows 98. That's an Internet Explorer file. Try repairing or updating your version of Internet Explorer. "Patrice" <duet@centurytel.net> wrote in message news:0e2501c3808f$e01495f0$3501280a@phx.gbl... > I am unable to open Money 2000!! I am receiving the > following error message "MSMoney caused an invalid page > fault in module MSVCRT.DLL at 0167:78012cbc. Is ...

Unhide the Application Window
I have vba code in an Access program that calls and manipulates data in an Excel spreadsheet. All the manipulation code works fine. This spreadsheet is unsecured (by design) and can be viewed by anyone. The problem is that after my code works on the file, the next time it is opened (not by any code) the application is hidden and the user must go to the menu bar and manually unhide the window. Is there code to rectify this situation? *****Posted via: http://www.ozgrid.com Excel Templates, Training & Add-ins. Free Excel Forum & Business Software***** This is a guess. If your users...

windows log on/off notification
I'm implementing windows service for windows 2000. And must know when user log on and log of from Windows. There is a notificatin, that sends to service, when user logged on/off. But it is only in XP. How can I do it in Win 2000. Help me, please, if you know. Best regards. Check out OnQueryEndSession() or WM_QUERYENDSESSION Cheers Peter "Antonio Passado" <antoniopassado@hotmail.com> wrote in message news:%23bJ3tc31DHA.3196@TK2MSFTNGP11.phx.gbl... > I'm implementing windows service for windows 2000. And must know when user > log on and log of from Windows. The...

Sending a document to print causes the Windows 2003 print queue of that printer to go offline
Have a situation where sending a document (any) to print causes the Windows 2003 print queue/printer of that printer to go offline. The queue remains offline until the printer is power cycled. We can then print a single job before the queue/printer goes offline again. Was working fine, no changes made. We also have this printer and queue on another server and we get the same problem. Funny though if the printer is created on a Windows 2000 box the printer remains online after a document has printed. Im a twat. have now posted in correct section! Peeky wrote: > Have a situation where se...

Server Error in '/' Application. CurrentPrincipal is not authenticated.
Hello, Currently we have installed Business Portal but it is on an Exchange 2003 server and we are getting the following when connecting to the url http://server/sites/BusinessPortal/default.aspx Everything is set to default so if anyone has any suggestions as to how to solve this it would be greatly appreciated! Thanks, Caroline Server Error in '/' Application. -------------------------------------------------------------------------------- CurrentPrincipal is not authenticated. Description: An unhandled exception occurred during the execution of the current web request. Please rev...

how to run application(exe) in browser
hi, i have application, it's runs in local machine.i want to run application in browser. <arumuthu@gmail.com> wrote in message news:2062e55f-d173-476e-b241-58602bf9d6a5@u36g2000prf.googlegroups.com... > hi, > i have application, it's runs in local machine.i want to run > application in browser. There is no magic bullet for this. You will need to develop an ActiveX control which can be then hosted in a browser. -- Ajay A lot of us are rewriting applications that need to be hosted in a browser using ASP.NET/C# and maintaining a native version and a web version....

DLL tell what type of application is running.
I'm writing a general purpose error handler that will be used by Windows Apps, Web Apps, Window's Services, ... In other words - just about any program will be calling it. Part of this error routine would be to put up a message box if it's a windows app but only if it's a windows app. How can I make sure that the application that is running is actually a Window's app. I currently am passing in parameters to display the message if appropriate but I want to make sure that somebody doesn't by accident call the routine with a message to display for something ...