hi!

i have an activex control for Word. i want to send Printing command to
my Container(Word) to print itself at specific location from within my
ActiveX (My be on clicking some context menu item.) is it possible to
do that. if so then plz help me.

A sample code will help a lot.

Thanks in advance.

Ahmad Jalil Qarshi

Re: How to Access Container from within an ActiveX Control! by Igor

Igor
Thu Apr 07 10:49:49 CDT 2005

"Ahmad" <Ahmad.Jalil.Qarshi@gmail.com> wrote in message
news:1112888527.207612.280430@z14g2000cwz.googlegroups.com
> i have an activex control for Word. i want to send Printing command to
> my Container(Word) to print itself at specific location from within my
> ActiveX (My be on clicking some context menu item.) is it possible to
> do that. if so then plz help me.

Try IOleClientSite::GetContainer, then query for Word's document object
interface (whatever that might be, I'm not familiar with Word's object
model).
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925



Re: How to Access Container from within an ActiveX Control! by Ahmad

Ahmad
Fri Apr 08 06:17:24 CDT 2005

Thanks Igor!
i have done following:

IOleClientSite *pClientSite = NULL;
this->GetClientSite(&pClientSite);
CComPtr<IOleContainer> pContainer;
HRESULT hr = pClientSite->GetContainer(&pContainer);
if (hr == S_OK)
{
CComQIPtr<MSWord::_Application> spApp(pContainer);
ATLASSERT(spApp);
}

hr is S_OK, so my if condition executes. but when i QI for interface
pointer of _Application, spApp gets nothing.
i think i m somewhere wrong. might be at QI. so Plz give me hand to
overcome this problem.

Thanks.

Ahmad Jalil Qarshi

Igor Tandetnik wrote:
> "Ahmad" <Ahmad.Jalil.Qarshi@gmail.com> wrote in message
> news:1112888527.207612.280430@z14g2000cwz.googlegroups.com
> > i have an activex control for Word. i want to send Printing command
to
> > my Container(Word) to print itself at specific location from within
my
> > ActiveX (My be on clicking some context menu item.) is it possible
to
> > do that. if so then plz help me.
>
> Try IOleClientSite::GetContainer, then query for Word's document
object
> interface (whatever that might be, I'm not familiar with Word's
object
> model).
> --
> With best wishes,
> Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going
to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925


Re: How to Access Container from within an ActiveX Control! by Igor

Igor
Fri Apr 08 08:45:26 CDT 2005

"Ahmad" <Ahmad.Jalil.Qarshi@gmail.com> wrote in message
news:1112959044.811576.56740@l41g2000cwc.googlegroups.com
> Thanks Igor!
> i have done following:
>
> IOleClientSite *pClientSite = NULL;
> this->GetClientSite(&pClientSite);
> CComPtr<IOleContainer> pContainer;
> HRESULT hr = pClientSite->GetContainer(&pContainer);
> if (hr == S_OK)
> {
> CComQIPtr<MSWord::_Application> spApp(pContainer);
> ATLASSERT(spApp);
> }

Try with the document interface, not application interface. _Document
perhaps?
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925



Re: How to Access Container from within an ActiveX Control! by Ahmad

Ahmad
Fri Apr 08 09:55:15 CDT 2005

Thanks Igor!

you are Guru. Thanks a lot.

Ahmad Jalil Qarshi


Re: How to Access Container from within an ActiveX Control! by Ahmad

Ahmad
Mon Apr 11 01:22:04 CDT 2005

Isn't it possible to get the _Application pointer of MS Word using this
_Document Pointer which i have gotten in my ActiveX control.

I have tried this one.

CComQIPtr<MSWord::_Document> spDoc(pContainer);
ATLASSERT(spDoc);
MSWord::_ApplicationPtr spApp = spDoc->GetApplication();

but not able to get the _ApplicationPtr.

Thanks

Ahmad Jalil Qarshi


Re: How to Access Container from within an ActiveX Control! by Igor

Igor
Mon Apr 11 09:02:27 CDT 2005

"Ahmad" <Ahmad.Jalil.Qarshi@gmail.com> wrote in message
news:1113200524.221644.124660@z14g2000cwz.googlegroups.com
> Isn't it possible to get the _Application pointer of MS Word using
> this _Document Pointer which i have gotten in my ActiveX control.
>
> I have tried this one.
>
> CComQIPtr<MSWord::_Document> spDoc(pContainer);
> ATLASSERT(spDoc);
> MSWord::_ApplicationPtr spApp = spDoc->GetApplication();
>
> but not able to get the _ApplicationPtr.

Like I said, I am not specifically familiar with Word's object model.
I'm afraid I cannot help you any further, sorry.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925



Re: How to Access Container from within an ActiveX Control! by suncertification

suncertification
Thu Apr 21 09:38:45 CDT 2005

Hello,

Could you tell me how can I learn ActiveX, OLE to understand clearly all of them ?

What books should I learn ?

Looking forward for your help.

Thanking you in advance for positive responses.

Re: How to Access Container from within an ActiveX Control! by Brian

Brian
Thu Apr 21 10:30:48 CDT 2005

You can bet a question like this has been asked and answered innumerable
times. That's why it is nice to simply search the archives first, before
posting a repeat question.

Might I suggest you use Google Groups and search for "books" in
microsoft.public.vc.atl (or wherever) to get the information you need.

e.g.;
http://www.google.ca/groups?hl=en&lr=&threadm=OzVPINlsEHA.2196%40TK2MSFTNGP14.phx.gbl&rnum=1&prev=/groups%3Fas_q%3Dbooks%26safe%3Dimages%26as_ugroup%3Dmicrosoft.public.vc.atl%26lr%3D%26hl%3Den

Best regards,

Brian

"Sun Cetification" <suncertification@gmail.com> wrote in message
news:1cbbce5f.0504210638.10f2865b@posting.google.com...
> Hello,
>
> Could you tell me how can I learn ActiveX, OLE to understand clearly all
of them ?
>
> What books should I learn ?
>
> Looking forward for your help.
>
> Thanking you in advance for positive responses.