Hi all.
I have a class:
CMyClass : public CWnd
{
...
HWND m_hImageWindow;
CBitmapButton m_HelpButton;
afx_msg void OnHelpBtnClick();
afx_msg LONG OnPictureClick( WPARAM wParam, LPARAM lParam );
afx_msg void OnTimer( unsigned int id ) ;
...
}
...
BEGIN_MESSAGE_MAP(CMyClass, CWnd)
...
ON_WM_TIMER()
ON_BN_CLICKED( 1, OnHelpBtnClick )
OnTimer function? the fiollowing line does not work
ON_MESSAGE(MESSAGE_ID, OnPictureClick)
...
END_MESSAGE_MAP()
...
afx_msg int CMyClass::OnCreate( LPCREATESTRUCT )
{
RECT rc;
SetRect( &rc, 100, 100, 120, 120 );
m_HelpButton.Create( 0, WS_VISIBLE | BS_OWNERDRAW, rc, this, 2 );
m_HelpButton.LoadBitmaps( IDB_BITMAP2, IDB_BITMAP3 );
}
afx_msg void CMyClass::OnTimer( unsigned int id )
{
if( m_hImageWindow )
{
::DestroyWindow( m_hImageWindow );
m_hImageWindow = NULL;
}
void* init = GetProcAddress( LoadLibrary( "atl" ), "AtlAxWinInit" );
_asm call init;
m_hImageWindow = CreateWindow( "AtlAxWin", somePictureURL,
WS_CHILDWINDOW | WS_VISIBLE, 0, 0, 100, 100,
this->GetSafeHwnd(), (HMENU)(UINT_PTR)MESSAGE_ID, (HINSTANCE)GetWindowLong( this->GetSafeHwnd(), GWL_HINSTANCE ), 0 );
}
afx_msg void CMyClass::OnHelpBtnClick()
{
}
afx_msg LONG OnPictureClick( WPARAM wParam, LPARAM lParam );
{
}
...
Can anybody tell me how I can implement the message handler for the window I created in OnTimer() and attach to this message handler the function OnPictureClick()?
Nelek: just format code