PsycleWTL:Win32 GUI Genericsを使用した再構築

公開:2004-12-31 08:16
更新:2020-02-15 04:36
カテゴリ:psycle wtl,windows,audio,tracker

ようやくWindowを表示できるようになりました。

そして、リソースDLLハンドル保持クラスはこのようになりました。

namespace detail { 
    class res_handle { 
    public: 
        ~res_handle(void){}; 
        static res_handle & instance(){ 
            if(m_pres_handle.get() == NULL){ 
                boost::mutex::scoped_lock _lock(m_mutex); 
                if(m_pres_handle.get() == NULL){ 
                    m_pres_handle = std::auto_ptr<res_handle>(new res_handle()); 
                } 
            } 
            return (*m_pres_handle); 
        } 
         
        operator HINSTANCE() const{ 
            return m_handle; 
        }; 
 
        void init(const HINSTANCE handle) 
        { 
            boost::mutex::scoped_lock _lock(m_mutex); 
            m_handle = handle; 
        };  
 
    private: 
        res_handle(){m_handle = default_instance();}; 
        HINSTANCE m_handle; 
        static std::auto_ptr<res_handle> m_pres_handle; 
        static boost::mutex m_mutex; 
    }; 
}; 
 
inline HINSTANCE resource_instance() { return static_cast<HINSTANCE>(detail::res_handle::instance());};
国別にリソースを読み込む部分もこっちに持ってくるべきかな...。