foobar2000 SDK  2015-08-03
Public Member Functions | Data Fields | Private Types
window_service_impl_t< _t_base >

#include <misc.h>

+ Inheritance diagram for window_service_impl_t< _t_base >:

Public Member Functions

 BEGIN_MSG_MAP_EX (window_service_impl_t) MSG_WM_DESTROY(OnDestroyPassThru) CHAIN_MSG_MAP(__super) END_MSG_MAP_HOOK() int FB2KAPI service_release() throw ()
 
void OnFinalMessage (HWND p_wnd)
 
int FB2KAPI service_add_ref () throw ()
 
 TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD_WITH_INITIALIZER (window_service_impl_t, t_base,{m_destroyWindowInProgress=false;m_delayedDestroyInProgress=0;}) private
 
- Public Member Functions inherited from CWindowFixSEH< _t_base >
BOOL ProcessWindowMessage (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD dwMsgMapID=0)
 
 TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD (CWindowFixSEH, _t_base)
 

Data Fields

pfc::refcounter m_counter
 
volatile LONG m_delayedDestroyInProgress
 
volatile bool m_destroyWindowInProgress
 

Private Types

typedef CWindowFixSEH< _t_base > t_base
 
typedef window_service_impl_t< _t_base > t_self
 

Detailed Description

template<typename _t_base>
class window_service_impl_t< _t_base >

Special service_impl_t replacement for service classes that also implement ATL/WTL windows.

Definition at line 307 of file misc.h.

Member Typedef Documentation

template<typename _t_base>
typedef CWindowFixSEH<_t_base> window_service_impl_t< _t_base >::t_base
private

Definition at line 310 of file misc.h.

template<typename _t_base>
typedef window_service_impl_t<_t_base> window_service_impl_t< _t_base >::t_self
private

Definition at line 309 of file misc.h.

Member Function Documentation

template<typename _t_base>
window_service_impl_t< _t_base >::BEGIN_MSG_MAP_EX ( window_service_impl_t< _t_base >  )
throw (
)
inline

Definition at line 312 of file misc.h.

317  {
318  int ret = --m_counter;
319  if (ret == 0) {
320  if (window_service_trait_defer_destruction(this) && !InterlockedExchange(&m_delayedDestroyInProgress,1)) {
321  PFC_ASSERT_NO_EXCEPTION( service_impl_helper::release_object_delayed(this); );
322  } else if (m_hWnd != NULL) {
323  if (!m_destroyWindowInProgress) { // don't double-destroy in weird scenarios
324  PFC_ASSERT_NO_EXCEPTION( ::DestroyWindow(m_hWnd) );
325  }
326  } else {
327  PFC_ASSERT_NO_EXCEPTION( delete this );
328  }
329  }
330  return ret;
331  }
pfc::refcounter m_counter
Definition: misc.h:345
volatile LONG m_delayedDestroyInProgress
Definition: misc.h:344
static bool window_service_trait_defer_destruction(const service_base *)
Definition: misc.h:302
volatile bool m_destroyWindowInProgress
Definition: misc.h:343
void release_object_delayed(service_ptr obj)
Definition: service.cpp:42
template<typename _t_base>
void window_service_impl_t< _t_base >::OnFinalMessage ( HWND  p_wnd)
inline

Definition at line 339 of file misc.h.

339  {
340  t_base::OnFinalMessage(p_wnd);
341  service_ptr_t<service_base> bump(this);
342  }
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
template<typename _t_base>
int FB2KAPI window_service_impl_t< _t_base >::service_add_ref ( )
throw (
)
inline

Definition at line 332 of file misc.h.

332 {return ++m_counter;}
pfc::refcounter m_counter
Definition: misc.h:345
template<typename _t_base>
window_service_impl_t< _t_base >::TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD_WITH_INITIALIZER ( window_service_impl_t< _t_base >  ,
t_base  ,
{m_destroyWindowInProgress=false;m_delayedDestroyInProgress=0;}   
)
inline

Definition at line 334 of file misc.h.

335 private:
336  void OnDestroyPassThru() {
337  SetMsgHandled(FALSE); m_destroyWindowInProgress = true;
338  }
volatile LONG m_delayedDestroyInProgress
Definition: misc.h:344
volatile bool m_destroyWindowInProgress
Definition: misc.h:343

Field Documentation

template<typename _t_base>
pfc::refcounter window_service_impl_t< _t_base >::m_counter

Definition at line 345 of file misc.h.

template<typename _t_base>
volatile LONG window_service_impl_t< _t_base >::m_delayedDestroyInProgress

Definition at line 344 of file misc.h.

template<typename _t_base>
volatile bool window_service_impl_t< _t_base >::m_destroyWindowInProgress

Definition at line 343 of file misc.h.


The documentation for this class was generated from the following file: