I wouldn't like to post the whole code here. Just tell what I have done for successful result :)
IDE: Microsoft Visual Studio .NET
1) Created new project: MFC Application, dialog-based.
2) Choose "Add class..." from menu "Project" .
3) Choose "MFC Class From ActiveX Control".
4) In the opened wizard: choose "Available ActiveX controls" - Image Uploader Control (don't forget to register Image Uploader Control by regsvr32 utility!). IImageUploader appeared in the interfaces list. Add (">>") it into "Generated classes". All other settings are by default.
5) In the header file: My project was named "IU4Holder5". I included generated "CImageUploader.h" into "IU4Holder5Dlg.h".
Then, in the public members area I placed a new member "CImageUploader m_objImageUploader;".
6) In the source file ("IU4Holder5.cpp"): I wrote initialization code in the method "OnInitDialog(...)", after "TODO:" section:
Code:
CRect rect;
GetClientRect(&rect);
m_objImageUploader.Create(_T("ImageUploader embedded"), _T("ImageUploader"), WS_CHILD | WS_VISIBLE, rect, this, 1234);
m_objImageUploader.put_Layout(_T("ThreePanes"));
m_objImageUploader.put_Action(_T("http:
m_objImageUploader.put_FolderPaneHeight(300);
m_objImageUploader.put_TreePaneWidth(300);
m_objImageUploader.ShowWindow(SW_SHOW);
7) In the header file ("IU4Holder5.h"): I used to add the standard destructor ("~CIU4Holder5()") and new message handler "afx_msg void OnDestroy();".
8) In the source file ("IU4Holder5.cpp"): I wrote the body for constructor and placed the destruction code there:
Code:
if (::IsWindow(m_objImageUploader.GetSafeHwnd()))
{
m_objImageUploader.DestroyWindow();
}
9) The same file: Add "ON_WM_DESTROY()" for the message handler "OnDestroy()", and wrote the body for it:
Code:
void CIU4Holder5Dlg::OnDestroy()
{
return;
}
...Thats it. Do the same and you will get the Image Uploader Control Holder to work.
Best regards,
George Ulyanov