Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2004

Tip: Looking for answers? Try searching our database.

GetOpenFileName bug

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rajko - 28 Apr 2004 17:06 GMT
GetOpenFileName with flag
OFN_ALLOWMULTISELECT
will create error message if number of characters exceeds 29700 characters.
I does not matter if you alocated enough space. It will use only first 32768
TCHARs.

Error message is file not found, and partial file name is displayed.

BTW what is the URL of error reporting site at MS.

Rajko.

PS Is there workaround for this bug?
David Lowndes - 29 Apr 2004 07:39 GMT
>GetOpenFileName with flag
>OFN_ALLOWMULTISELECT
>will create error message if number of characters exceeds 29700 characters.
>I does not matter if you alocated enough space. It will use only first 32768
>TCHARs.

Do you have a short code sample that illustrates the problem?

Which operating system(s) does this show up  on?

Dave
Signature

MVP VC++ FAQ: http://www.mvps.org/vcfaq

John Biddiscombe - 29 Apr 2004 13:08 GMT
And if you use multiselection and select all the files in one directory
where there are about 500 or so, it throws an exception "Too many files" or
something similar.
This is uselss when trying to read in sequences of images for analysis
etc...

JB

> >GetOpenFileName with flag
> >OFN_ALLOWMULTISELECT
[quoted text clipped - 7 lines]
>
> Dave
Rajko - 29 Apr 2004 15:39 GMT
I didn't see message "Too many files" but I tested with different file
names.
First I used file name:
TEMP_TEST 1000_COPY (1) OF EMPTY.TXT
TEMP_TEST 1000_COPY (2) OF EMPTY.TXT
...

error was at 802

then I put one more char in front all files, follows:
1TEMP_TEST 1000_COPY (1) OF EMPTY.TXT
1TEMP_TEST 1000_COPY (2) OF EMPTY.TXT
...

now error was at 783, but not at 802 so I calculated:
801*37+31 = 29668 TCHARs
or
782*38+26 = 29742 TCHARs

well it is about 32768 boundry for signed integer !!!

Rajko.

> And if you use multiselection and select all the files in one directory
> where there are about 500 or so, it throws an exception "Too many files" or
[quoted text clipped - 17 lines]
> >
> > Dave
Rajko - 29 Apr 2004 15:40 GMT
This is code from my app:
#define MAX_FILES_IN_OPEN_DIALOG   2000
....
void CMRenameDialog::SelectFiles() {
     OPENFILENAME ofn;
     TCHAR FileName[MAX_PATH]={0}, *FileDir;
     unsigned long FileNameOffset=0;
     DWORD szFileDir = MAX_FILES_IN_OPEN_DIALOG*MAX_PATH;
     FileDir = (TCHAR *)malloc(szFileDir*sizeof(TCHAR));
     FileDir[0] = NULL;

     ofn.lStructSize = sizeof(ofn);
     ofn.hwndOwner = m_hWnd;
     ofn.hInstance = NULL;
     ofn.lpstrFilter = _T("All Files(*.*)\0*.*\0\0");
     ofn.lpstrCustomFilter = NULL;
     ofn.nMaxCustFilter = 0;
     ofn.lpstrFile = FileDir;
     ofn.nMaxFile = szFileDir;     // in TCHARS
     ofn.lpstrFileTitle = FileName;
     ofn.nMaxFileTitle = sizeof(FileName)/sizeof(TCHAR);
     ofn.lpstrInitialDir = m_SelectedFileDir;
     ofn.lpstrTitle = WINDOWS_OPEN_DIALOG_TITLE;
     ofn.Flags = OFN_ALLOWMULTISELECT | OFN_EXPLORER | OFN_FILEMUSTEXIST |
OFN_LONGNAMES;
     ofn.nFileOffset = 0;
     ofn.lpstrDefExt = NULL;
     ofn.lpfnHook = NULL;
     ofn.lpTemplateName = NULL;

     if (GetOpenFileName(&ofn)) {   <--- this is the line where execution
stoped
       .....

I created dir C:\Temp\Test 1000 which containde 1000 files:
TEMP_TEST 1000_COPY (1) OF EMPTY.TXT
TEMP_TEST 1000_COPY (2) OF EMPTY.TXT
...
TEMP_TEST 1000_COPY (801) OF EMPTY.TXT
TEMP_TEST 1000_COPY (802) OF EMPTY.TXT
TEMP_TEST 1000_COPY (803) OF EMPTY.TXT
...
TEMP_TEST 1000_COPY (999) OF EMPTY.TXT
TEMP_TEST 1000_COPY (1000) OF EMPTY.TXT

open dialog appears and I select all 1000 files, then MessageBox appear with
following text:
TEMP_TEST 1000_COPY (802) OF E
File not found.
Please verify the correct file name was given.

That's it, Rajko.

> >GetOpenFileName with flag
> >OFN_ALLOWMULTISELECT
[quoted text clipped - 7 lines]
>
> Dave
David Lowndes - 29 Apr 2004 17:30 GMT
>This is code from my app:

... and the operating systems you've tested against?

Dave
Rajko - 29 Apr 2004 18:41 GMT
XP pro v2002 SP1, and most of SP2.
MS Dev Env 2003    v7.1.3088
.NET Framework   v1.1.4322

Just this one, for now.

Rajko

> >This is code from my app:
>
> ... and the operating systems you've tested against?
>
> Dave
David Lowndes - 29 Apr 2004 22:25 GMT
>I created dir C:\Temp\Test 1000 which containde 1000 files:
>TEMP_TEST 1000_COPY (1) OF EMPTY.TXT
[quoted text clipped - 5 lines]
>File not found.
>Please verify the correct file name was given.

OK, I can reproduce the same error message when I click OK after
selecting a large number of files.

I note that the documentation for GetOpenFileName says this:

"Note, when selecting multiple files, the total character limit for
the file names depends on the operating system and the version of the
function.

Windows 2000/XP: (ANSI) 32k limit, (Unicode) no restriction "

but according to these results, this isn't correct because I get
exactly the same results with an ANSI and Unicode build.

I'm not aware of any work-around - if you don't get any other
suggestions here I suggest that you contact MS PSS and give them a
minimal sample in order to reproduce the problem. I'll try to pass
this on to MS myself, but it may take some time before I get an
answer, so I recommend that you ring PSS - please let us know the
outcome by posting back if you do so.

Dave
Signature

MVP VC++ FAQ: http://www.mvps.org/vcfaq

Rajko - 30 Apr 2004 08:32 GMT
> OK, I can reproduce the same error message when I click OK after
> selecting a large number of files.
[quoted text clipped - 18 lines]
>
> Dave

I used Unicode version, but not explicitly like GetOpenFileNameW.
Compiler take care of it as far as I know.

Could you tell me in more detail how and where to contact MS PSS?
thx

Rajko
David Lowndes - 30 Apr 2004 09:28 GMT
>Could you tell me in more detail how and where to contact MS PSS?

I can't tell you specifically because it depends on your location and
whether your company has any special support options. Try
http://support.microsoft.com and the "Contact Us" link. That should
get you to your local MS support options (it does for me in the UK).

Dave
Rajko - 30 Apr 2004 20:29 GMT
OK. Thanks Dave.
BTW I'm form Croatia.

Rajko.

> >Could you tell me in more detail how and where to contact MS PSS?
>
[quoted text clipped - 4 lines]
>
> Dave
Rajko - 02 May 2004 05:37 GMT
I can't find it on support!!!!
I realy tried, but nothing one hour ow the web and nothing!!!
I tried switching to US page and still nothing.
Can you tell me your report a bug page, I mean UK page.
I could switch to your page and then send it.

Thx, Rajko.
PS And i thought it would be large button so you cant miss it! :-)
They hide it from me very well.
BTW I never reported a bug till now.

> >Could you tell me in more detail how and where to contact MS PSS?
>
[quoted text clipped - 4 lines]
>
> Dave
David Lowndes - 03 May 2004 00:11 GMT
>I can't find it on support!!!!
>I realy tried, but nothing one hour ow the web and nothing!!!
>I tried switching to US page and still nothing.
>Can you tell me your report a bug page, I mean UK page.
>I could switch to your page and then send it.

http://support.microsoft.com/default.aspx?scid=fh;[ln];CNTACTMS

and then to:

http://support.microsoft.com/default.aspx?scid=fh;en-gb;telephonems

but all the information is UK specific, so I don't see that it'll be
any help to you.

Dave
Signature

MVP VC++ FAQ: http://www.mvps.org/vcfaq

Rajko - 03 May 2004 08:14 GMT
I see. So you contacted them over telephone.
I thought there is online form for submiting bugs.

I found this one:
http://support.microsoft.com/default.aspx?scid=%2Fsupport%2Fvisualc%2Freport%2Fd
efault.asp

but it doesn't work!!
When I submit page error occurs:
An error occurred rendering the requested content.
URL:
http://support.microsoft.com/support/visualc/report/vcsubmit.asp?SD=GN&LN=HR

I called mine support and they never heard of such thing as bug report.
At the end they gave me following e-mail to contact them:
infoline@microsoft.hr with subject "hotline".
I do not need to say more, don't I? If this is bug report centar then I'm
turtle.
So, I was disappointed and don't know what to do.

Rajko.

> >I can't find it on support!!!!
> >I realy tried, but nothing one hour ow the web and nothing!!!
[quoted text clipped - 12 lines]
>
> Dave
Ronald Laeremans [MSFT] - 03 May 2004 16:57 GMT
Hi Rajko,

Using the phone is the only method that works. If you call again and cannot
get the support engineer to give you the support you need, ask them to
contact me (Ronald Laeremans, Group Program Manager, Visual C++). And please
send me an email (mangle my posting alias in the obvious way) with their
exact name so I can follow up.

Sorry for the runaround you got.

Thanks.

Ronald Laeremans

>I see. So you contacted them over telephone.
> I thought there is online form for submiting bugs.
[quoted text clipped - 32 lines]
>>
>> Dave

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.