0

Windows の EDIT ウィンドウクラスからエディット ボックス付きのウィンドウを作成するモジュールを作成しました。ANSI 文字セットでのみ動作し、Unicode を使用しないように設計されています。

EM_GETHANDLEを使用して、エディット コントロールへのバッファーを受け取ります。

ここに私の問題があります:(上記のリンクから引用)

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.

そのため、comctl32 が初期化されたアプリケーションによってモジュールが読み込まれると、コード全体が壊れます。

私の質問: CreateWindowA が comclt32 を使用するのを防ぐ方法はありますか、またはこの問題を解決するアイデアはありますか?

4

1 に答える 1

1

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.

于 2013-02-11T12:27:51.590 に答える