< VB6 API ビューアの ENUMLOGFONTEX 構造体宣言の誤り | EXTRACT の ORA-30076 >

December 21, 2004

IDL ファイルのコンパイル時に MIDL2039 の警告が出る

VC++6.0 (5.0もらしいけど) で、ATL COM AppWizard プロジェクトを作成し、挿入 - ATLオブジェクトの新規作成を選択して、何かコントロールを追加する。コントロールの設定で、ストックプロパティを追加するときに、Font を含めてみよう。

warning MIDL2039 : interface does not conform to [oleautomation] attribute : [ Parameter 'pFont' of Procedure 'putref_Font' ( Interface 'IMyControl' ) ]
warning MIDL2039 : interface does not conform to [oleautomation] attribute : [ Parameter 'pFont' of Procedure 'put_Font' ( Interface 'IMyControl' ) ]
warning MIDL2039 : interface does not conform to [oleautomation] attribute : [ Parameter 'ppFont' of Procedure 'get_Font' ( Interface 'IMyControl' ) ]

とまあ、警告がずらずら。この件は、MS のサポート技術情報にも、FIX: MIDL2039 Warning with IFontDisp/IPictureDisp Parameter Type として取り上げられている。

SYMPTOMS

When you compile an .idl file with IFontDisp or IPictureDisp as parameters of methods in Visual C 5.0 or Visual C 6.0, you get a MIDL2039 warning.

IFontDisp か IPictureDisp をパラメータにとるメソッドを含む IDL をVC++5.0か6.0コンパイルすると MIDL2039 が警告される

CAUSE

This is due to a bug in Ocidl.idl source. You must add the dual attribute to the interface declarations for IFontDisp and IPictureDisp.

Ocidl.idl ソースのバグ。IFontDisp と IPictureDisp のインターフェース宣言にdual属性を追加しなければならない。

RESOLUTION

To prevent the warning, add the dual attribute to the IFontDisp and IPictureDisp interface declarations in Ocidl.idl, as in the following example:

Ocidl.idl の IFontDisp と IPictureDisp のインターフェース宣言に、以下にならってdual属性を追加してねん。

// VC++6.0 の場合、1039行目あたり
   [
      object,
      dual,        // 追加
      uuid(BEF6E003-A874-101A-8BBA-00AA00300CAB),
      pointer_default(unique)
   ]

   interface IFontDisp : IDispatch
   {
      typedef IFontDisp * LPFONTDISP;
   }

   [
      object,
      dual,        // 追加
      uuid(7BF80981-BF32-101A-8BBB-00AA00300CAB),
      pointer_default(unique)
   ]

   interface IPictureDisp : IDispatch
   {
      typedef IPictureDisp * LPPICTUREDISP;
   }

とまあ、思わず適当な訳までつけてしまったが、要するにそうゆう事らしい。

トラックバック

このエントリーにトラックバック:
http://frog.raindrop.jp/cgi-bin/mt/mt-tb.cgi/764

コメント

コメントする

※ コメントスパム対策のため、コメント本文はおはよう、こんにちわ、こんばんわのいずれかより始めるようにしてください。

name:
email:

※ 必要ですが、表示しません。

url:
情報を保存する ?