ホーム » MFC » コンソール AP で MFC

2017年3月
 1234
567891011
12131415161718
19202122232425
262728293031  

カテゴリー

アーカイブ

ブログ統計情報

  • 79,501 アクセス



コンソール AP で MFC

コンソール AP で,MFC(AfxWin.h など)に依存したコードを利用


新しく書いたものは,次の様なコードで可能.

  #include	"EnhMetaF.hxx"
  #include	"i_trace.hxx"
  
  int _tmain(int argc, TCHAR* argv[])
  {
    	_tsetlocale(LC_ALL,_T("")) ;
    	{
      		EnhMetaF	emf ;
      		CMetaFileDC*	mfdc = emf.GetDC() ;
      		mfdc->Rectangle(10,10,30,20) ;
    		}
    	return 0 ;
    	}

古いコードは,うまく対応できてないので…

  #undef  	_CONSOLE
  #include	<AfxWin.h>
  #include	<AfxExt.h>
  #include	<AfxCmn.h>
  #ifdef	_WIN32
  #define  	_WINDOWS
  #endif
  #include	"MessCon.hxx"
  #include	"MessBar.hxx"
  #ifdef	MessageBar
    #undef	MessageBar
    #define	MessageBar	MessageCon
    #undef	I_SUPPORT_MESSAGE_MFC
  #endif
  #include	"MessWrap.hxx"
  // ...
  int _tmain(int argc, TCHAR* argv[])
  {
    	#ifdef	_MFC_VER
    	if (!::AfxWinInit(::GetModuleHandle(NULL),NULL,::GetCommandLine(),0)) {
      		return	1 ;
      		}
    	#else
    	_tsetlocale(LC_ALL,_T("")) ;
    	#endif
    //	...
    	}

undef の幾つかは,自コードの対応のために必要.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

コメントする

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

%d人のブロガーが「いいね」をつけました。