|
Previously, I have an ActiveX control which I use it in my MFC GUI program.
The wrapper class (inheritanced from CWnd) for the activex control is generated automatically through class wizard. Everything just work fine.
Now, I need my application to work in non-gui mode. Hence, no dialog or windows will be created to host the active x control.
I just copy the ActiveX wrapper class file, which is generated previously, into my console project. i realize that a runtime error will occur whenever i try to use the active x control. this is because there is no dialog/ or windows to host that activex control.
I read an article at http://www.codeproject.com/com/consoleactivex.asp
The author shows the way by using COM. However, i am not familiar with COM. I prefer to use back the wizard generated wrapper source code, which is much more easier.
may i noe how can i solve this problem? do i need to created a hidden window for it? or is there better way?
thanks!
cheok
|
|
|
|
|
Use the class wizard to generate a wrapper class, not derived from CWnd, but from COleDispatchDriver.
In ClassWizard click Add Class then select From a type libary and select the .tlb file of your control.
After you have the wrapper class call CoCreateInstance to create the object, something like:
IDispatch* pDisp;
CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, dispid, &pDisp);
where clsid is the class id for the object, dispid is the ID of object's IDispatch interface
After a successful call of CoCreateInstance use the AttachDispatch method from the wrapper class and then you can call ActiveX methods, like this:
CWrapperClass myDisp;
myDisp.AttachDispatch(pDisp);
myDisp.SomeActiveXMethod();
Remember to call CoInitialize before CoCreateInstance and when you're done using the object call pDisp->Release() in order to decrement the object's reference count and destroy it.
|
|
|
|
|
Thanks. Using COleDispatchDriver as parent class really work!
I didn't use AttachDispatch since I cann't make it works. Most probably I miss out something. However, by using CreateDispatch just rock I assume there is no clean up needed after CreateDispatch from the MSDN example.
Thanks for help!
cheok
|
|
|
|
|
This component is produced by Giga.INC. Please give me some information and suggestion of this. Thanks!
|
|
|
|
|
Respected all
I have picturebox on my DialogBox(Dialog based MFC app) ,, when I run my prog, the bitmap displayed on picture box but when the size of bitmap s max then problem r coming b/c the Dialog boc which have a picture box has its feault sizze so how i can change the size of dialog box to its max, size.
so that no problem to me while to display large bitmaps.
Thanking u people
david
|
|
|
|
|
Recommend reading the articles at CP on resizable dialogboxes.
I also recommend that you write your questions in english; I lost you at "s max", "r", "Dialog boc" and "feault sizze", so I have no idea if my interpretations where even close to correct.
INTP
Every thing is relative...
|
|
|
|
|
Try ShowWindow(SW_MAXIMIZE). Look up ShowWindow on MSDN for all kinds of other uses.
Danny
|
|
|
|
|
Is there a property of a CDialog to set the object INSIDE the MainFrame, like the ChildFrame in an MDI application? That is: I don't want that the Dialog could exit from the border of the main frame, but I want that that border hides a portion of the dialog (if it is trying to come outside).
Thanks
|
|
|
|
|
if you look at the CDialog constructor, you'll see that it gets a CWnd* parameter named Parent ...
so, when your MDI creates the dialog box, it passes this to the constructor and that should work...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi,
I tryed it, but didn't change nothing...I think that this is only a way to set the relations between the windows (like the closing order).
I'm quite sure that my problem could solve changing some flag(s) into the dialog style/properties,... but what?
|
|
|
|
|
You were so close.In properties tab set Style to child rather than overlapped or pop up
|
|
|
|
|
Hi, thanks for your help.
I think that we are near to the solution.
But...ehm...
I change the style-flag... and the program tilts.
Try to change that flag with the about-box on an MDI program.
What I'm wronging?
|
|
|
|
|
Matteo_78 wrote:
...and the program tilts.
I know that pinball machines can do this, but I was not aware of a program that could tilt.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
check stryle clip siblings,and while creating dialog box make main frame window as parent.
|
|
|
|
|
Now, I writed a ActiveX, I use HttpSendRequestEx function to send request to server. when I run the ActiveX two times, this function is down.
(I have not had a server, I'm Creating server).
pls help me.
Many thanks.
|
|
|
|
|
Why won't my CHtmlView object display HTML files correctly when they have tables with merged cells (colspan property)? Internet explorer shows these files OK.
What can I do?
|
|
|
|
|
Oops, I had a bug in my own code. It renders fine!
Andrew
|
|
|
|
|
Hi,
How can I get the font name and font size of the title bar?
Thank you.
- NS -
|
|
|
|
|
This has most probably to do with system fonts and themes. I would start and search in this direction
~RaGE();
|
|
|
|
|
|
Hi
If you mean CPropertySheet use
void PressButton(<br />
int nButton <br />
);
it Simulates the choice of the specified button in a property sheet.
nButton : Identifies the button to be pressed. This parameter can be one of the following values:
PSBTN_BACK Chooses the Back button.
PSBTN_NEXT Chooses the Next button.
PSBTN_FINISH Chooses the Finish button.
PSBTN_OK Chooses the OK button.
PSBTN_APPLYNOW Chooses the Apply Now button.
PSBTN_CANCEL Chooses the Cancel button.
PSBTN_HELP Chooses the Help button.
Iman Ghasrfakhri
|
|
|
|
|
In CPropertyPage, how can I call PressButton?
|
|
|
|
|
In your child class of CPropertyPage define a function to set its parent,then call PressButton of its parent you set
Iman Ghasrfakhri
|
|
|
|
|
I've tried, but CPropertySheet is not the parent of CPropertyPage.
|
|
|
|
|
Add a function to page, when you add the page to sheep ,set page's sheet yourself,
sheet.AddPage(page1);<br />
page1.setParentSeet(&sheet);
---------------------------------------
void CPage::setParentSeet(CProperiSheet *sheet)<br />
{<br />
m_ParentSheet = sheet;<br />
}
---------------------------------------
then every where in pages you have a pointer to sheet
isn't it ?
Iman Ghasrfakhri
|
|
|
|