ホーム » 2010 » 6月

月別アーカイブ: 6月 2010

2010年6月
 12345
6789101112
13141516171819
20212223242526
27282930  

カテゴリー

アーカイブ

ブログ統計情報

  • 79,628 アクセス



hdc が拡張メタファイルのデバイスコンテキスト?

hdc が拡張メタファイルのデバイスコンテキストかどうかを調べるには、GetObjectType 関数
GetDeviceCaps
GetObjectType

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

マルチバイト→UNICODE

「構成プロパティ」-「全般」-「文字セット」を「マルチバイト...」から「UNICODE...」に変更すると,以下のエラーになることがある.
msvcrtd.lib(wcrtexew.obj) : error LNK2019: 未解決の外部シンボル _wWinMain@16 が関数 ___tmainCRTStartup で参照されました。

vcproj をエディタなどで開き,";_MBCS;$(NoInherit)" を削除.

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

メニューが左にポップアップ…

1 ヶ月半ぐらい前,メニューが左にポップアップされる様になっていることに気がついた.
タブレット BAMBOO CTH-460 を接続した時に設定をいじってしまった様で,この設定にやっとたどり着いた.
(別に困っていたわけではないので,特に調べていたわけではありません.)
メニューが左にポップアップ


//mish.myds.me/wordpress/dev/2011/03/01/

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

StringArrayToString と VC

以下のコードで,VC のそれぞれのバージョン,32 ビット MBCS/UNICODE で約 1 M 文字の変換を計測
BOOL O_StringArrayToString(const CStringArray& strAry,CString& str,const CString& sp=_T("rn"))
{
  for (int lineCount=0 ; lineCount<strAry.GetSize() ; lineCount++) {
    str += strAry.GetAt(lineCount) ;
    if (str.Right(sp.GetLength()) != sp) {
      str += sp ;
      }
    }
  return TRUE ;
  }

    1+2
x 333,333
999,999 文字
10+2
x 83,333
999,996 文字
100+2
x 9,803
999,906 文字
1,000+2
x 998
999,996 文字
VC 6.0 MB 351.205 88.576 9.984 0.962
VC 7.0 MB 0.351 0.280 0.231 0.210
VC 7.1 MB 0.351 0.290 0.240 0.230
VC 8.0 MB 0.340 0.250 0.220 0.231
VC 9.0 MB 0.360 0.240 0.240 0.201
VC 10. MB 0.090 0.020 0.000 0.000
VC 6.0 WC 936.567 228.458 25.857 2.584
VC 7.0 WC 1.342 1.281 1.252 1.261
VC 7.1 WC 1.462 1.282 1.252 1.272
VC 8.0 WC 1.392 1.281 1.252 1.242
VC 9.0 WC 1.382 1.322 1.302 1.232
VC 10. WC 0.080 0.020 0.010 0.010


VC 10 は,ほとんど無視できる速度.
VC 7 ~ VC 9 は,UNICODE exe で少し時間がかかる.
VC 6 exe では,ループの回数にかなり影響を受ける
(恐らく領域の割り当ての関係と思われる).
また,CString のサイズが大きくなる(ループの lineCount が大きくなる)程,遅くなった.


綺麗なコードでないが,~ VC 9 の場合に置き換える
 
BOOL N_StringArrayToString(const CStringArray& strAry,CString& str,const CString& sp=_T("rn"))
{
  CStringArray tmpSA ;
  CString tmpStr ;
  for (int lineCount=0 ; lineCount<strAry.GetSize() ; lineCount++) {
    tmpStr += strAry.GetAt(lineCount) ;
    if (tmpStr.Right(sp.GetLength()) != sp) {
      tmpStr += sp ;
      }
    if ((lineCount%100-1) == 0) {
      tmpSA.Add(tmpStr) ;
      tmpStr.Empty() ;
      }
    }
  if (!tmpStr.IsEmpty()) {
    tmpSA.Add(tmpStr) ;
    }
  if (tmpSA.GetSize() > 1) {
    ::N_StringArrayToString(tmpSA,str,sp) ;
    }
  else if (tmpSA.GetSize() == 1) {
    str = tmpSA[0] ;
    }
  else {
    return FALSE ;
    }
  return TRUE ;
  }
 
…/Test/TsSAtoS.zip

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

VC 8 double の配列をメモリダンプ

VC 8 で座標のデータをダンプ

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

「無効な引数が発生しました。」

MFC 7.1 以降,AfxThrowInvalidArgException が呼ばれるようになっている


C:\Program Files\Microsoft Visual Studio\VC98\MFC\Include\AfxColl.inl Line 96
  _AFXCOLL_INLINE DWORD& CDWordArray::ElementAt(int nIndex)
    { ASSERT(nIndex >= 0 && nIndex < m_nSize);
      return m_pData[nIndex]; }
 
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\AfxColl.inl Line 126
  _AFXCOLL_INLINE DWORD& CDWordArray::ElementAt(INT_PTR nIndex)
    { ASSERT(nIndex >= 0 && nIndex < m_nSize);
      if( nIndex < 0 || nIndex >= m_nSize )
        AfxThrowInvalidArgException();
      return m_pData[nIndex]; }
—————————
App
—————————
無効な引数が発生しました。
—————————
OK
—————————

nIndex が配列の範囲を超えている場合に ASSERT .


2010/06/15 追記
VC8 AtlSimpStr.h Line 389
 XCHAR operator[]( __in int iChar ) const
  {
   ATLASSERT( (iChar >= 0) && (iChar <= GetLength()) );  // Indexing the ” is OK
   if( (iChar < 0) || (iChar > GetLength()) )
    AtlThrow(E_INVALIDARG);
   return( m_pszData[iChar] );
  }
—————————
App
—————————
パラメータが間違っています。
—————————
OK  
—————————

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