Question What is the easiest way to determine the string type of the DLL

aaaron

Well-known member
Joined
Jan 23, 2011
Messages
219
Programming Experience
10+
If I use Declare Auto and the OS is UNICODE and the DLL is ANSI the runtime will not convert the UNICODE to ANSI.

Is that correct?

If so, why the word AUTO?

If I must tell the runtime what conversion to use what is the easiest way to determine the string type of the DLL?
 
Historic reasons probably. It also controls name mangling, for example you could import MessageBox auto to resolve OS default MessageBoxA or MessageBoxW with automatic right charset. Some resources:
One of those also says:
Make sure you know what representation your native representation expects when picking your charset.
How to find/figure out? There should be documentation (or maybe just header files), here for example for MessageBox:
The W version uses "wide" unicode strings LPCWSTR.
This is sometimes useful: Windows Data Types (BaseTsd.h) - Win32 apps

Also, if it is a common function you could find declarations on the web.
For Windows declarations this is something I wished existed many years ago, although it has been around a few years now: GitHub - dahall/Vanara: A set of .NET libraries for Windows implementing PInvoke calls to many native Windows APIs with supporting wrappers.
 
Back
Top