15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Determining container identity from within OLE server

Jon Steer -- jsteer@bitscout.com
Sunday, December 29, 1996

Environment: VC++ 4.2b, Win 95, NT 4.0


I am attempting to determine the identity (name,executable,clsid,...) of
the container application that has launched my embedded document server.

I need to be able to determine this fairly early on (preferably
within the InitInstance of my application.

I have seen several other applications (notably Lotus Notes) which
seem to be able to determine this, but I can't seem to figure out
what to use.

I thought that I might be able to figure this out using windows references
but lookingwith Spy++ showed me that my OLE server windows are not children
of the container application.

I also looked around with ROTViewer while containers were active and
discovered that no names/monikers were available for me to use.

thanks,
 jon

Jon Steer ---  BitScout Software,Inc --- Software Consulting and Products
Specialties: Device Drivers, Communications, H.320 Systems Consulting
BitScout Software,Inc 40 Berkeley St, Nashua N.H. 03060
phone:(603)889-1185   video: (603)889-1125  fax: (603)-883-9365
E-mail: jsteer@BitScout.com   URL: http://www.BitScout.com/
"I got a box!!" a joyous Lucy Steer, age 2.5; receiving her Christmas
present before realizing that there was actually something inside.




Bing Hou -- hou@tfn.com
Monday, December 30, 1996

     Hi Jon,
     
     Override the COleServerDoc::OnSetHostNames(LPCSTR lpszHost,
                           LPCSTR lpszHostObj)
     
     Where lpszHost is the container application's name and the
     lpszHostObj is the container document's name.
     
     The OnSetHostNames is called if your application is an embedded 
     object. And it's called before anything shows so it is fairly early 
     on.
     
     Hope this gives you some idea, if you need more information, please 
     refer to Brockschmidt's Inside OLE sec. edit. Chapter 18 'OLE 
     Documents and Local Embedding Servers'.
     
     -Bing
     


______________________________ Reply Separator _________________________________
Subject: Determining container identity from within OLE server
Author:  Jon Steer  at Internet
Date:    12/29/96 11:11 PM


Environment: VC++ 4.2b, Win 95, NT 4.0
     
     
I am attempting to determine the identity (name,executable,clsid,...) of 
the container application that has launched my embedded document server.
     
I need to be able to determine this fairly early on (preferably 
within the InitInstance of my application.
     
I have seen several other applications (notably Lotus Notes) which 
seem to be able to determine this, but I can't seem to figure out 
what to use.
     
I thought that I might be able to figure this out using windows references 
but lookingwith Spy++ showed me that my OLE server windows are not children 
of the container application.
     
I also looked around with ROTViewer while containers were active and 
discovered that no names/monikers were available for me to use.
     
thanks,
 jon
     
Jon Steer ---  BitScout Software,Inc --- Software Consulting and Products 
Specialties: Device Drivers, Communications, H.320 Systems Consulting 
BitScout Software,Inc 40 Berkeley St, Nashua N.H. 03060 
phone:(603)889-1185   video: (603)889-1125  fax: (603)-883-9365
E-mail: jsteer@BitScout.com   URL: http://www.BitScout.com/
"I got a box!!" a joyous Lucy Steer, age 2.5; receiving her Christmas 
present before realizing that there was actually something inside.
     



Mike Blaszczak -- mikeblas@nwlink.com
Monday, December 30, 1996

At 23:11 12/29/96 -0500, Jon Steer wrote:
>Environment: VC++ 4.2b, Win 95, NT 4.0

>I am attempting to determine the identity (name,executable,clsid,...) of
>the container application that has launched my embedded document server.

Why?  This is incredibly unorthodox, and swims against the modular,
independent nature of OLE. Your object should work fine no matter who's
containing it.  If you need to know anything in particular about the
container, you should QI for interfaces that your container implements.
If you get NULL back, those interfaces don't exist and you can't do
whatever special behaviour you were thinking of.

>I have seen several other applications (notably Lotus Notes) which
>seem to be able to determine this, but I can't seem to figure out
>what to use.

What does Notes do with that information?

.B ekiM
http://www.nwlink.com/~mikeblas/
I'm afraid I've become some sort of speed freak.
These words are my own. I do not speak on behalf of Microsoft.




Jon Steer -- jsteer@bitscout.com
Tuesday, December 31, 1996

At 04:42 PM 12/30/96 -0800, Mike Blaszczak wrote:
>At 23:11 12/29/96 -0500, Jon Steer wrote:
>>Environment: VC++ 4.2b, Win 95, NT 4.0
>
>>I am attempting to determine the identity (name,executable,clsid,...) of
>>the container application that has launched my embedded document server.
>
>Why?  This is incredibly unorthodox, and swims against the modular,
>independent nature of OLE. 

 Yes, and no. My server application uses Netmeeting to talk to
 it's equivalent application/document on the other side.

 If my server doc/app is embedded in another document type,
 I want to launch that application remotely so that 
 both documents/app's can converse.

 There are a large number of reasons why I don't want to
 do this with NetMeeting application sharing.

 I can see many reasons why somebody might want to embedd
 better value-add functionality in their containers and
 be better coupled between container/server.

>Your object should work fine no matter who's
>containing it.  If you need to know anything in particular about the
>container, you should QI for interfaces that your container implements.
>If you get NULL back, those interfaces don't exist and you can't do
>whatever special behaviour you were thinking of.

 Hmmm... That's another interesting way to determine my container and
 probably more generic to what I'm doing. Thanks!

The immediate answer that was given to me by Bing Hou (thanks! Bing)
is to override OnSetHostNames which gives me the application. However,
one of the problems with this is that OnSetHostNames has a (bug/feature/
documentation error) where it gives the document type not the actual 
document name (including path).
You also don't get a new call to OnSetHostNames when the container
document changes name (i.e. SaveAs) which is a problem for me.

Lotus Notes uses this information to allow information sharing between
the container (Notes) and the server (for example, Visio). Lotus calls
this "technology" Notes/FX.

jon

Jon Steer ---  BitScout Software,Inc --- Software Consulting and Products
Specialties: Device Drivers, Communications, H.320 Systems Consulting
BitScout Software,Inc 40 Berkeley St, Nashua N.H. 03060
phone:(603)889-1185   video: (603)889-1125  fax: (603)-883-9365
E-mail: jsteer@BitScout.com   URL: http://www.BitScout.com/
"I got a box!!" a joyous Lucy Steer, age 2.5; receiving her Christmas
present before realizing that there was actually something inside.





| Вернуться в корень Архива |