掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
リストビューのリストコントロールをサブクラス化には (ID:62113)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
CWnd::SubclassWindow(HWND hWnd)の内部にです: BOOL CWnd::SubclassWindow(HWND hWnd) { if (!Attach(hWnd)) //GetSafeWnd()使用したらここにエラー出る return FALSE; // allow any other subclassing to occur PreSubclassWindow(); // now hook into the AFX WndProc WNDPROC* lplpfn = GetSuperWndProcAddr(); WNDPROC oldWndProc = (WNDPROC)::SetWindowLongPtr(hWnd, GWLP_WNDPROC,(INT_PTR)AfxGetAfxWndProc()); ASSERT(oldWndProc != AfxGetAfxWndProc()); //!!Detach()使用したらここにエラーが出る! if (*lplpfn == NULL) // the first control of that type created *lplpfn = oldWndProc; #ifdef _DEBUG else if (*lplpfn != oldWndProc) { TRACE(traceAppMsg, 0, "Error: Trying to use SubclassWindow with incorrect CWnd\n"); TRACE(traceAppMsg, 0, "\tderived class.\n"); TRACE(traceAppMsg, 0, "\thWnd = $%08X (nIDC=$%08X) is not a %hs.\n", (UINT)(UINT_PTR)hWnd, _AfxGetDlgCtrlID(hWnd), GetRuntimeClass()->m_lpszClassName); ASSERT(FALSE); // undo the subclassing if continuing after assert ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, (INT_PTR)oldWndProc); } #endif return TRUE; } HWND hListCtrl = GetListCtrl().GetSafeHwnd(); にしたら、Attachできないようです。 HWND hListCtrl = GetListCtrl().Detach(); にしたら、ASSERT(oldWndProc != AfxGetAfxWndProc())でエラーが出る! どうしてエラーが出てるか訳が分からないです
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.