I get the following error, that the function ReadDirectoryChangesW() is never declared? Can anyone help me why?
I use Win2k
Loada
June 8th, 2004, 03:59 AM
You must be using UNICODE for it to work.
Make sure you have _UNICODE and UNICODE in your pre-processor project settings.
housefreak
June 8th, 2004, 04:07 AM
Thats now my pre-processor settings:
WIN32,_DEBUG,_CONSOLE,_MBCS,_UNICODE
and it never work with this settings? why?
Mick
June 8th, 2004, 09:36 AM
1. If you are using precompiled headers <stdafx.h> or <whateverpcheader> do not put anything before them.
2. ReadDirectoryChangesW(...) is wrapped in a:
#if(_WIN32_WINNT >= 0x0400)
You need to define _WIN32_WINNT to be 0x400 or greater. And DO NOT PUT any includes or defines or whatever before your precompiled header that is: #include <stdafx.h>
housefreak
June 8th, 2004, 10:52 AM
i do that what you say but it never work?
this is my actual code:
// dirCon.cpp : Definiert den Einsprungpunkt für die Konsolenanwendung.
//
1) You don't need all those headers. If you turn off pre-compiled headers for the moment, and comment out stdafx.h, what results do you get?
2) Why are you using CString? Just use the literal. I hope you weren't using MFC just for those unneccessary uses of CString. In any event, use std::string instead of CString if you're going to code a Win32 application.
Regards,
Paul McKenzie
Mick
June 8th, 2004, 10:59 AM
#define _WIN32_WINNT 0x0400
do that before you include any system headers (as they may #include <winbase.h> indirectly where ReadDirectoryChangesW lives at this moment) but not before you include your precompiled headers, or just move it into your precompiled headers <stdafx.h>...or add it to your preprocessors in the c++ settings.
cvogt61457
June 8th, 2004, 11:00 AM
You say it doesn't work ??
What errors are you getting?
What exactly do you mean? Be specific !!!
housefreak
June 8th, 2004, 11:06 AM
when i use the code as follows:
// dirCon.cpp : Definiert den Einsprungpunkt für die Konsolenanwendung.
//
#include "stdafx.h"
The ReadDirectoryChangesW gets recognized by the compiler without all of those extra headers you have in your code. The code I posted, plus the preprocessor settings, compiles the code with no problems.
Maybe if you show us exactly where you added these definitions, and how you added them (did you make a mistake, i.e. a typo?)
Regards,
Paul McKenzie
Paul McKenzie
June 8th, 2004, 11:09 AM
when i use the code shown 2 posts above i get the error that the function ReadDirectoryChangesW() is an unknwon argument!
hope thats specific enough!!
Thanks much You are getting closer with the code that I posted. Now, the reason why you have an error is that you are not setting the preprocessor define correctly. Either you mistyped it in your settings, or something else. But it isn't being recognized.
Regards,
Paul McKenzie
MrViggy
June 8th, 2004, 11:10 AM
The mistake is what Mick pointed out earlier. Don't do:
#define _WIN32_WINNT >= 0x0400
Do:
#define _WIN32_WINNT 0x0400
Better yet, look at Paul's example. It is a *lot* cleaner!
Viggy
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.