When you say "I put a Picture Control to a Dialog Form" I understand that you have already assigned an ID to this CStatic control , let be it ID_MY_PICTURE and it should be defined in the resource.h and also in the .rc file.
To access the control at run time use :
CStatic * pStatic= (CStatic*)GetDlgItem( ID_MY_PICTURE );
if (pStatic)
{
pStatic->SetBitMap();
pStatic->GetBitmap();
}
Put these statements in the OnInitDialog() or when you cklick on the picture by implementing the BN_CLICKED event:
class CMyDlg : public CDialog
{
public:
//
afx_msg void OnMyPicture();
//
};
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
//{{AFX_MSG_MAP(CMyDlg)
ON_BN_CLICKED(IDC_MY_PICTURE, OnMyPicture)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CMyDlg::OnMyPicture()
{
// TODO: Add your control notification handler code here
}
Another solution is to add a DDX exchange variable associated with this control.
-obislavu-