ホーム » 2011 » 6月

月別アーカイブ: 6月 2011

2011年6月
 1234
567891011
12131415161718
19202122232425
2627282930  

カテゴリー

アーカイブ

ブログ統計情報

  • 80,090 アクセス



Win 7 TaskBar Pin

C:\Users\[UserName]\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

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

LBS_HASSTRINGS を忘れると…

オーナ描画リストボックスで,GetText を呼出した時
LBS_HASSTRINGS を忘れると
コントロールの LBS_HASSTRINGS が指定されていない.


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

CInternetFile::ReadString

CInternetFile::ReadString
CInternetFile::ReadString
VC 6 UNICODE.exe で,文字化けと,中身がうまく処理されない.MBCS.exe はOK.
文字化けは,CHAR から TCHAR への変換を正しく処理することにより対応.
それでも,まだ改行の位置で戻らず,終端も正しくない(デバッグ版ではゴミ ‘0xCD’ が入る).
どうも,VC 6 や 7 では,うまく処理できないみたい.VC 8 では期待した動作と思われる.

  CHttpConnection* pServer = pServer = session.GetHttpConnection (svrName) ;
  CHttpFile* pFile = pServer->OpenRequest (CHttpConnection::HTTP_VERB_GET,name) ;
  pFile-> SendRequest () ;
  {
    CString buf ;
    while (pFile->ReadString(buf)) {
      CString tmp = ::ToStringTC(LPCSTR(LPCTSTR(buf))) ;
      rBuf.Add(tmp) ;
      }
    ::StringArrayToString(rBuf,rData) ;
    }

http://support.microsoft.com/kb/329071
Microsoft KB Archive/329071
 PRB: CInternetFile::ReadString Does Not Convert Non-Unicode Text to Unicode Text


2019/01/31 LPCSTR , LPCWSTR からの変換
CRT_MBWC.hxx
tstrmbwc.hxx


2022/09/09 CHttpFile Read String

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

MS11-025 その後

以前,KB2465367 などの影響を受けたが,その対応版 KB2538218 のコードの抜粋
typedef BOOL (WINAPI *PFNFINDACTCTXSECTIONSTRING)(DWORD, const GUID *, ULONG, LPCTSTR, PACTCTX_SECTION_KEYED_DATA);
static HINSTANCE _AfxLoadLangDLL(LPCTSTR pszFormat, LPCTSTR pszPath, LCID lcid)
{
 TCHAR szLangDLL[_MAX_PATH+14];
 TCHAR szLangCode[4];
 HINSTANCE hInstance = NULL;
 if (lcid == LOCALE_SYSTEM_DEFAULT) {
  Checked::tcscpy_s(szLangCode, _countof(szLangCode), _T("LOC"));
  }
 else {
  int nResult;
  nResult = ::GetLocaleInfo(lcid, LOCALE_SABBREVLANGNAME, szLangCode, 4);
  if (nResult == 0)
    return NULL;
  ASSERT( nResult == 4 );
  }
 int ret;
 ATL_CRT_ERRORCHECK_SPRINTF(ret = _sntprintf_s(szLangDLL,_countof(szLangDLL),_countof(szLangDLL)-1,pszFormat,pszPath,szLangCode));
 if(ret == -1 || ret >= _countof(szLangDLL)) {
  ASSERT(FALSE);
  return NULL;
  }
 TCHAR *pszFilename = ::PathFindFileName(szLangDLL);
 ACTCTX_SECTION_KEYED_DATA data = {sizeof(data)};
 HMODULE hKernel = GetModuleHandle(_T("KERNEL32"));
 PFNFINDACTCTXSECTIONSTRING pfnFindActCtxSectionString = NULL;
 if (hKernel != NULL) {
  #ifdef _UNICODE
   pfnFindActCtxSectionString = (PFNFINDACTCTXSECTIONSTRING)GetProcAddress(hKernel, "FindActCtxSectionStringW");
  #else
   pfnFindActCtxSectionString = (PFNFINDACTCTXSECTIONSTRING)GetProcAddress(hKernel, "FindActCtxSectionStringA");
  #endif
  }
 if (pfnFindActCtxSectionString &&
 pfnFindActCtxSectionString(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, pszFilename, &data)) {
  // Load using the dll name only…
  hInstance = ::LoadLibraryEx(pszFilename, NULL, 0);
  }
 else {
  // Load using the full path…
  hInstance = ::LoadLibraryEx(szLangDLL, NULL, 0);
  }
 return hInstance;
 }

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

コンソール AP リンクエラー

——————–構成: XXxxXXxx – Win32 Debug——————–
コンパイル中…
XXxxXXxx.cpp
リンク中…
nafxcwd.lib(thrdcore.obj) : error LNK2001: 外部シンボル “__endthreadex” は未解決です
nafxcwd.lib(thrdcore.obj) : error LNK2001: 外部シンボル “__beginthreadex” は未解決です
Debug/XXxxXXxx.exe : fatal error LNK1120: 外部参照 2 が未解決です。
link.exe の実行エラー

XXxxXXxx.exe – エラー 3、警告 0

「C/C++」-「コード生成」-「使用するランタイムライブラリ」を 「マルチスレッド (デバッグ)」 に


 
——————–構成: XXxxXXxx – Win32 Debug——————–
コンパイル中…
XXxxXXxx.cpp
リンク中…
nafxcwd.lib(afxmem.obj) : error LNK2005: “void __cdecl operator delete(void *)” (??3@YAXPAX@Z) はすでに LIBCMTD.lib(dbgdel.obj) で定義されています
Debug/XXxxXXxx.exe : fatal error LNK1169: 1 つ以上の複数回定義されているシンボルが見つかりました
link.exe の実行エラー

XXxxXXxx.exe – エラー 2、警告 0

http://support.microsoft.com/kb/148652/ja
Visual C++ で CRT ライブラリおよび MFC ライブラリのリンク順序が正しくないときに LNK2005 エラーが発生する

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

ドロップしたフォルダを開く

「ドロップされたファイルのフォルダを開く」ツールの改良版

http://cid-535f5973454c1292.office.live.com/self.aspx/.Public/Tools/DropOpen.2011.08.10.zip


i_Tools

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

ListBoxDocMF の使い方で...

以前の,画像付ファイル名リストボックス(ListBoxDocMF)の利用方法の改良
前の方法では,対応する画像(EMF)が存在しない,または見つからないと,意図した動作にならない.
そのため,ファイルを登録する時に,対応画像が存在しないとそれを作成して登録する方法.
DImageS::Draw を利用している.
BOOL CDropOpenDlg::UpdateDImgLB()
{
  CWaitCursor wait ;
  ::TrimSameString(DropFiles) ;
  {
    static DelFileE dfe ;
    DImgAry.RemoveAll() ;
    long len = 0 ;
    int makeCount = 5 ;
    for (int dIndex=0 ; dIndex0) {
        dfe.Add(mfName) ;
        MetaFile mf(FALSE) ;
        CWnd* mainWnd = AfxGetMainWnd() ;
        CRect rect(0,0,100,100) ;
        if (!mf.Create(mainWnd,rect,mfName)) { return FALSE ; }
        CMetaFileDC* mfDC = mf.GetMetaDC() ;
        {
          dImg.Draw(mfDC,rect) ;
          }
        mf.Close() ;
        makeCount– ;
        dfe.Add(::GetFileDir(mfName)) ;
        }
      DImgAry.Add(dImg) ;
      len = max(len,dropFile.GetLength()) ;
      }
    m_CtrlDropFiles.ResetContent() ;
    for (int rIndex=0 ; rIndex<DImgAry.GetSize() ; rIndex++) {
      CString fileName = DImgAry.GetAt(rIndex).GetFileName() ;
      m_CtrlDropFiles.AddString(fileName,fileName) ;
      CString mfName = CacheFile::GetCF_Name(fileName,1000) ;
      if (::FileIsExist(mfName)) {
        m_CtrlDropFiles.SetAtDocMF(rIndex,mfName) ;
        }
      else {
        HICON icon = DImageS_GetIcon(fileName) ;
        m_CtrlDropFiles.SetAtIcon(rIndex,icon) ;
        }
      }
    ::SetHorizontalExtent(&m_CtrlDropFiles,len) ;
    }
  return TRUE ;
  }
画像付ファイル名リストボックス(ListBoxDocMF)

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