From: WJ on
I have a class (common class, not derived from MFC) that has a DeleteFile()
memeber function.

But in the class view, it shows as DeleteFileA(), and if I declare a
instance of this class and call DeleteFileA(), it works. In the debugger, it
goes into DeleteFile().

Why is it so? Thanks.
From: Alexander Grigoriev on
See windows.h:

#define DeleteFile DeleteFileA

By the way, it doesn't make sense to do non-UNICODE software anymore, which
yours seems.


"WJ" <WJ(a)discussions.microsoft.com> wrote in message
news:65A2276D-C9E6-4E7B-9B88-8D711FE065A3(a)microsoft.com...
>I have a class (common class, not derived from MFC) that has a DeleteFile()
> memeber function.
>
> But in the class view, it shows as DeleteFileA(), and if I declare a
> instance of this class and call DeleteFileA(), it works. In the debugger,
> it
> goes into DeleteFile().
>
> Why is it so? Thanks.


From: Joseph M. Newcomer on
This is a stupid error caused by Intellinonsense. You SHOULD be using DeleteFile, which
is the abstract Win32 API interface function. However, DeleteFile is a fiction; it does
not really exist. Instead, depending on your settings (you have not defined _UNICODE or
UNICODE symbols) if you are doing an "ANSI" (stupid name) build, the macro DeleteFile
expands to DeleteFileA and if you are doing a Unicode build, the macro DeleteFile expands
to DeleteFileW. It is essentially an ERROR to code it as DeleteFileA if you want
portability to Unicode, and you normally only use the -A and -W suffixes explicitly under
EXTREMELY exotic circumstances. But due to terminally stupid design, Intellinonsense
insists on giving you the API you are currently configured for, instead of the CORRECT API
name, so it takes extra effort to undo this blunder.

In the debugger, it will call either DeleteFIleA or DeleteFileW, since these are the only
APIs that exist.
joe

On Wed, 7 Apr 2010 08:15:03 -0700, WJ <WJ(a)discussions.microsoft.com> wrote:

>I have a class (common class, not derived from MFC) that has a DeleteFile()
>memeber function.
>
>But in the class view, it shows as DeleteFileA(), and if I declare a
>instance of this class and call DeleteFileA(), it works. In the debugger, it
>goes into DeleteFile().
>
>Why is it so? Thanks.
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: David Webber on


"Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message
news:32opr59pg75c1qg70qfdjhj899mrjh342q(a)4ax.com...

>...You SHOULD be using DeleteFile, which
> is the abstract Win32 API interface function....
>... CORRECT API name...

This is a philosophical question I have been wrestling with. I have
(later than some, sooner than others) converted my char's to TCHAR's and
then defined UNICODE so that they secretly become wchar_t's (and in the
process found one or two of the exotic exceptions - in particular ASCII
character numbers turning to UNICODE code points in one or two font handling
APIs).

Now I am totally in the groove with Unicode - I love it. But the future
appears a bit misty in one respect.

I too feel that DeleteFile(), rather than DeleteFileA() or DeleteFileW(),
is the 'proper' API. Its name *feels* right. But OTOH, while TCHAR was
great for converting from char to wchar_t, I'm now so totally unicoded that
I feel I should be using wchar_t and L"Hello world" instead of TCHAR and
_T("Hello world"). But that of course means using DeleteFileW() and
friends, instead of DeleteFile() and friends, for consistency. At least
currently.

Now I *suppose* one could start using DeleteFile() with wchar_t (now that
UNICODE is defined), but that would effectively be making the assumption
that DeleteFileA() and DeleteFileW() will eventually disappear, leaving
DeleteFile() once again as the only genuine version of the API function, but
now taking wchar_t strings. Has in fact the future been thus defined?

Dave

--
David Webber
Mozart Music Software
http://www.mozart.co.uk
For discussion and support see
http://www.mozart.co.uk/mozartists/mailinglist.htm

From: Joseph M. Newcomer on
See below...
On Wed, 7 Apr 2010 23:05:59 +0100, "David Webber" <dave(a)musical-dot-demon-dot-co.uk>
wrote:

>
>
>"Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message
>news:32opr59pg75c1qg70qfdjhj899mrjh342q(a)4ax.com...
>
>>...You SHOULD be using DeleteFile, which
>> is the abstract Win32 API interface function....
>>... CORRECT API name...
>
>This is a philosophical question I have been wrestling with. I have
>(later than some, sooner than others) converted my char's to TCHAR's and
>then defined UNICODE so that they secretly become wchar_t's (and in the
>process found one or two of the exotic exceptions - in particular ASCII
>character numbers turning to UNICODE code points in one or two font handling
>APIs).
>
>Now I am totally in the groove with Unicode - I love it. But the future
>appears a bit misty in one respect.
>
>I too feel that DeleteFile(), rather than DeleteFileA() or DeleteFileW(),
>is the 'proper' API. Its name *feels* right. But OTOH, while TCHAR was
>great for converting from char to wchar_t, I'm now so totally unicoded that
>I feel I should be using wchar_t and L"Hello world" instead of TCHAR and
>_T("Hello world"). But that of course means using DeleteFileW() and
>friends, instead of DeleteFile() and friends, for consistency. At least
>currently.
****
Actually, you would be using WCHAR, LPWSTR, and LPCWSTR. There is very little reason in
Windows programming to ever use wchar_t as a data type.

The failure is that Intellinonsense fails to understand the difference between what is the
official Win32 API and some random (character-set-dependent) implementation of that
interface. This is one of its numerous failures, which is why I don't ever care to use
it. I have no interest in using something that so consistently (a) gets things wrong (b)
fails to find the correct API call (c) fails to provide any useful information (such as
the decoding of UINT and DWORD flag values) when working with APIs. Since I have to bring
up the documentation anyway, I don't think it "saves" me anything. All it does is annoy
me.
****
>
>Now I *suppose* one could start using DeleteFile() with wchar_t (now that
>UNICODE is defined), but that would effectively be making the assumption
>that DeleteFileA() and DeleteFileW() will eventually disappear, leaving
>DeleteFile() once again as the only genuine version of the API function, but
>now taking wchar_t strings. Has in fact the future been thus defined?
****
The official API is defined. Intellinonsense doesn't recognize it. That is the failure
of Intellinonsense.
joe
****
>
>Dave
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm