Skip to main content
gamedev.net
🔒 Locked

Quick Win32 question

Started by Nodger May 13, 2004 at 9:45 AM 1 replies 300+ views
Original Post
Nodger
Nodger
When Im using the FindFirstFile function to scan directory, how do I specify multiple file types? for instance if I want to find all .jpg and .jpeg files
Nodger
Nodger
Wow no response. Maybe it`s not as cut-and-dry as I thought. The Win32 API docs just say :
quote:
Windows 95: Points to a null-terminated string that specifies a valid directory or path and filename, which can contain wildcard characters (* and ?). This string must not exceed MAX_PATH characters.
Windows NT: Points to a null-terminated string that specifies a valid directory or path and filename, which can contain wildcard characters (* and ?).
There is a default string size limit for paths of MAX_PATH characters. This limit is related to how the FindFirstFile function parses paths. An application can transcend this limit and send in paths longer than MAX_PATH characters by calling the wide (W) version of FindFirstFile and prepending "\\?\" to the path. The "\\?\" tells the function to turn off path parsing; it lets paths longer than MAX_PATH be used with FindFirstFileW. This also works with UNC names. The "
\\?\" is ignored as part of the path. For example, "\\?\C:\myworld\private" is seen as "C:\myworld\private", and "\\?\UNC\bill_g_1\hotstuff\coolapps" is seen as "\\
bill_g_1\hotstuff\coolapps".
S1CA
S1CA
You could use wildcards to drastically narrow the search:

*.jp* or *.jp??

Then exclude any false matches (e.g. "blah.jpx") in your own code.

AFAIK, that''s the only way to do it under Win32 apart from performing two searches, one for *.jpg and one for *.jpeg.

[Roll on LH/WinFS...]


Simon O''Connor
Game Programmer &
Microsoft DirectX MVP
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.