-
November 28th, 2005, 02:00 PM
#1
Using FindFirstFileEx to find a file of type .rpt [VC++6]
There is a folder (\RptTmpl\) that should always be a folder of where my application is being run (so if the program is in c:\temp\ then there should be a c:\temp\rpttmpl\ folder), and in this folder there are a lot of .rpt files (report templates).
I need to ensure there is at least ONE .rpt file in that folder, so I thought the best idea would be to use "FindFirstFileEx" to find the 1st .rpt file in that folder and if true then all is good and my program can continue (else return/exit).
Problem is I can't seem to get my FindFirstFileEx to work correctly....
Code:
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
hFind = FindFirstFileEx("\\DATA\\RPTTMPL\\*.rpt", &FindFileData); // this is line 158
if (hFind == INVALID_HANDLE_VALUE)
{
return RET_NORPTTEMPLATES;
}
FindClose(hFind);
Oddly this is causing two errors as shown below:
Error #1: App.cpp(158) : error C2065: 'FindFirstFileEx' : undeclared identifier
Error #2: App.cpp(158) : error C2440: '=' : cannot convert from 'int' to 'void *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Any clue what I am doing wrong?
Any help/hints would be greatly appreciated, thanks.
-
November 28th, 2005, 02:04 PM
#2
Re: Using FindFirstFileEx to find a file of type .rpt [VC++6]
Hi,
FindFirstFileEx takes 6 parameters. Are you confusing it with FindFirstFile?
Jeff
-
November 28th, 2005, 02:31 PM
#3
Re: Using FindFirstFileEx to find a file of type .rpt [VC++6]
MSDN
FindFirstFileEx
[...]
To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0400 or later. For more information, see Using the SDK Headers.
Anyhow, to simply assure there is at least one .rpt file in a folder FindFirstFile is much more than enough.
-
November 28th, 2005, 02:33 PM
#4
Re: Using FindFirstFileEx to find a file of type .rpt [VC++6]
FindFirstFileEx() is defined in winbase.h which is included in windows.h.
It requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation 4.0, Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0, so the _WIN32_WINNT macro should be defined as 0x0400 or later.
See http://msdn.microsoft.com/library/de...irstfileex.asp
Edit: Ovidiu is quicker than me!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|