typ1232
typ1232

Reputation: 5607

Forcing an ANSI edit control instead of the comctl32 edit control

I built up a module that creates a window with an edit box from windows' EDIT windowclass. It is designed to only work with ansi character set and not using any unicode.

I make use of EM_GETHANDLE to recieve the buffer to the edit control.

Now here is my problem: (quoted from link above)

Note For Comctl32.dll version 6, the buffer always contains an array of WCHARs, regardless of whether an ANSI or Unicode function created the edit control. For more information on DLL versions, see Common Control Versions.

So when my module gets loaded by an application that has comctl32 initialized, my whole code breaks.

My Question: Is there a way to prevent CreateWindowA to use comclt32 or does anyone have an idea to fix this problem?

Upvotes: 0

Views: 385

Answers (1)

mity
mity

Reputation: 2349

The application uses COMCTL32.DLL if it is specified in the app's manifest as described e.g. here: http://msdn.microsoft.com/en-us/library/windows/desktop/bb773175%28v=vs.85%29.aspx

If your module is DLL, then you might try use some isolation technique so it does not rely on what version of COMCTL32.DLL the .exe decided to use, but that might bring many other drawbacks.

I recommend to use WM_GETTEXTA or GetWindowTextA() instead, which will copy converted string into your buffer. Designing a module which requires old version of a DLL to work correctly is simply bad idea.

Upvotes: 1

Related Questions