ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

File Dialog - pattern for files without extension

Hello,
I'm using FileDialog and I want the user to select only files without extension. Does anybody know how?

Simple example:
"doc" extension (test.doc) = *.doc
no extension (test)= I don't know

Thanks
LV 2011, Win7
0 Kudos
Message 1 of 9
(6,142 Views)
Use "*."


LabVIEW, C'est LabVIEW

Message 2 of 9
(6,137 Views)
I've already tried but it doesn't work...
LV 2011, Win7
0 Kudos
Message 3 of 9
(6,119 Views)

Hi ceties,

There is no way to get the native Windows File Dialog to display only files with no extension.  This is a limitation of the file dialog mechanism in Windows, not in LabVIEW.  The only way to accomplish what you want is to use the non-native file dialog...to do this, you can go to Tools > Options > Environment and deselect "Use native file dialogs".  Of course, the disadvantage of using the non-native file dialog is that your file dialogs will look nothing like the standard Windows file dialogs when you do this.

-D

Message 4 of 9
(6,108 Views)
Hi Darren,
I thought that it would be impossible with standard windows dialog.
LabView dialog looks really scary 🙂
Thanks Darren
LV 2011, Win7
0 Kudos
Message 5 of 9
(6,093 Views)
It's not impossible with the standard windows dialog box.  They offer the ability to receive notification messages to a callback function for every item in the directory to be displayed to the user.  You can determine whether or not to include each item in the list.  You will probably need to write a callback function in C/C++ or some other text based language to interface this to LabVIEW.

From MSDN:

The CDN_INCLUDEITEM notification message provides another way to filter the names that the dialog box displays. To use this message, provide an OFNHookProc hook procedure and specify the OFN_ENABLEINCLUDENOTIFY flag in the OPENFILENAME structure when you create the dialog box. Each time the user opens a folder, the dialog box sends a CDN_INCLUDEITEM notification to your hook procedure for each item in the newly opened folder. The return value of the hook procedure indicates whether the dialog box should display the item in the folder's item list.
----
I am the founder of CnCSoftwareSolutions. When not cleaning up baby drool, I write about test data or work on Vision, a tool for understanding your test data. Visit me at www.cncsoftwaresolutions.com
Message 6 of 9
(6,084 Views)

It's my understanding that the actual API by which you call the Windows file dialog does not allow the setting of a pattern to only list files with no extension...or maybe it allows it, but it doesn't work.

-D

0 Kudos
Message 7 of 9
(6,080 Views)
Yes, but by creating and registering a callback function when you create the dialog box you can filter the listed files on an individual basis.  This is probably too low level for labview, but can be done in LabWindows.

When you create the dialog you pass a pointer to the callback function.  Windows will call this callback function once for every file in the directory to be displayed.  If you return a 0 the file will not be displayed.  If you return a non-zero value, the file will be displayed in the list. 

Read the section on filtering carefully near the end.  Take a look at CDN_INCLUDEITEM notification and OFNHookProc.  Again, I think you will need to move to a language closer to the hardware than labview as labview cannot create function pointers.

----
I am the founder of CnCSoftwareSolutions. When not cleaning up baby drool, I write about test data or work on Vision, a tool for understanding your test data. Visit me at www.cncsoftwaresolutions.com
0 Kudos
Message 8 of 9
(6,071 Views)
Hi daijoubu,
thank you very much but it looks too complicated for me and in addition C language is not "language of my heart".
LV 2011, Win7
0 Kudos
Message 9 of 9
(6,059 Views)