By attach i mean, i have a dialog class which I created in the activex project which has combobox, edit box etc.
I want to display this dialog box in the activex control draw method.
Is it possible?
Exactly Mike, that's what i am trying to do.
But when i do exactly what the article says i get error :winocc.cpp line 307. Basically it doesn't like the movewindow method. I tested the control using visual studio activex test control container. Tried with IE as the article says same error message.
Any suggestion?
Last edited by tarunk; February 15th, 2008 at 05:58 AM.
Reason: adding
It's probably a timing issue. That error indicates that the window is not valid at that time. You may need to restructure the sequence of code that creates the control.
hi! You are right. I was trying different things,i put the code to create the dialog in the constructor of the control and it wouldn't error now and it wouldn't display the content of my dialog also.
Code:
CReportXCtrl::CReportXCtrl()
{
InitializeIIDs(&IID_DReportX, &IID_DReportXEvents);
// TODO: Initialize your control's instance data here.
m_reportDlg.Create(IDD_XDIALOG , this);
}
no changes in oncreate.
in draw method the same as the article says....
Code:
m_reportDlg.MoveWindow(rcBounds, TRUE);
This is surely more than jsut vc2003 and vc2005 issue... can't believe i am having problem one after another. Has anyone made a dialog frame to display in a mfcactivex ctrl porgram?
I'm using Visual Studio 2005 and I followed the sample program in the article above. I was able to build and display the control in the test container. Make sure you set the resource flags for the dialog as stated in the article.
That's strange. I tried again exactly with the resources and everything mentioned. Didn't work. Point no 5. says using classwizard create oncreate(wm_create) , i don't know if it sounds silly. But i created a virtual OnCreate(LPCREATESTRUCT lpCreateStruct) in the ctrl.h and cpp and added the code.
Here is a .h and .cpp file as i can't attach the entire project(too big). if you can help to find out what is wrong.
thanks
Corrected the virutal to afx_msg...that was a silly mistake.
isn't OLEMISC_STATUS for ATL activex ctrl... i tried to add it, but the compiler complains. I believe i need to add the atl header files. Documentation says OLEMISC_SIMPLEFRAME(miscstatus) but my code is happy with void. Bit confusing. Also if i try with the second addition, the activex container complaines there is an unknown error. Not easy isn't it?
Actually, it was easy for me. I used the project wizard to create the skeleton code. The "frame" option was provided via the wizard. The only changes I made were those recommended by the article.
I used the project wizard too, mfc activex control wizard. If i edit just the first part you mentioned, making it afx-msg, my container says unspecified error(i wrongly wrote only after the second addition). I wish i could get this done.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.