New to C++, so i thought i'd post this in here. Apologies if I should have put this in the Windows section. I'm trying to write some code to search Active Directory using winldap.h. According to the documentation, the ldap_search_s function requires the filter and attribute parameters to be passed as PWSTR, but i cant figure out how to successfully initialise or assign a PWSTR variable. I've tried...
PWSTR filter = L"filters";
But this gives the error.
a value of type "const wchar_t *" cannot be used to initialize an entity of type "PWSTR"
Weirdly, this works fine on Visual Studio 2015, but not on Visual Studio 2017...
Tried messing with UNICODE, c_str(), c_str, _T but just cannot get this to work.
what I gave you was seriously the crudest thing that would work, though.
there is probably a more elegant answer, if you really want to dig into it.
The M$ renaming of everything to poorly named cryptic gibberish has always turned me off. Wait until you encounter all the functions that expect a 'handle' type. /wrist.