Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I use FindFirstFile() and FindNextF

Status
Not open for further replies.

tokool

Programmer
Nov 6, 2001
40
0
0
US
I use FindFirstFile() and FindNextFile() to browse thru a directory containing shortcut(.ink)
how can i resolves the attributes of a shortcut file.
Thanks,
Preetham.
 
In VB you could use the following, which may give you a pointer to a solution in whatever language you are using.:
[tt]
Dim wsh As Object
Dim shortcut As Object

Set wsh = CreateObject("wscript.shell")
Set shortcut = wsh.CreateShortcut("c:\windows\desktop\cheatm~1.lnk") 'Path of an existing shortcut
MsgBox shortcut.TargetPath
 
If you use FindFirstFile and FindNextFile, you must have declared a WIN32_FIND_DATA structure. This is defined this way:

typedef struct _WIN32_FIND_DATA {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[ MAX_PATH ];
TCHAR cAlternateFileName[ 14 ];
} WIN32_FIND_DATA, *PWIN32_FIND_DATA;

The first field (dwFileAttributes) contains the attributes. You can test it with all the FILE_ATTRIBUTE_.... constants,
like:
if ( wfd.dwFileAttributes == FILE_ATTRIBUTE_SYSTEM )
{ // This is a system file
.... }

Marcel


 
I am sorry, the statement should be:

if ( wfd.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM )
{ // This is a system file
... }

Use & instead of ==

Marcel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top