PsycleWTL

公開:2003-11-18 22:32
更新:2020-02-15 04:36
カテゴリ:psycle wtl,windows,audio,tracker

今日はMIDIモニタダイアログのBUG修正を行いました。
CDCクラスの挙動がMFCとWTLでは異なることが原因でBugが発生していました。

000368| LRESULT CMidiMonitorDlg::OnCtlColorDlg(UINT /uMsg/,
WPARAM wParam, LPARAM lParam, BOOL& bHandled) 000369| { 000370| // get the default background brush 000371| 000372| WTL::CDC _dc((HDC)wParam); 000373| 000374| HWND _ctl = (HWND) lParam; 000375| 000376| MIDI_STATS * pStats = CMidiInput::Instance()->GetStatsPtr(); 000377| 000378| // set required static colours 000379| 000380| if( _ctl == (HWND)m_psycleMidiActive ) 000381| _dc.SetTextColor( DARK_GREEN ); 000382| 000383| if( _ctl == (HWND)m_receivingMidiData ) 000384| _dc.SetTextColor( DARK_GREEN ); 000385| 000386| if( _ctl == (HWND)m_syncAdjust ) 000387| { 000388| if( pStats->syncAdjuster < 0 ) 000389| { 000390| // bad 000391| _dc.SetTextColor( DARK_RED ); 000392| } 000393| else 000394| { 000395| // good 000396| _dc.SetTextColor( DARK_GREEN ); 000397| } 000398| } 000399| 000400| if( _ctl == (HWND)m_resyncTriggered ) 000401| { 000402| _dc.SetTextColor( DARK_RED ); 000403| } 000404| 000405| _dc.Detach(); 000406| bHandled = TRUE; 000407| return 0; 000408| } 000409|
WTLの場合はスコープを抜けると参照DCが削除されてしまうので、スコープを抜ける前にdetach()をしなくてはいけないようです。