webbrowser_ctl >> How to use PutProperty and GetProperty

by Emily » Thu, 24 Feb 2005 17:53:00 GMT

Hi,
How to use the methods PutProperty and GetProperty?
I have checked the MSDN and jsut got to know the purpose of these two
functions "Sets the value of a property associated with the object." and
"Retrieves the value of a property associated with the given object. "
But I still do not understand how to use these two methods.
Are there anyone who can help me?

Thank you.

Eva



webbrowser_ctl >> How to use PutProperty and GetProperty

by Igor Tandetnik » Thu, 24 Feb 2005 23:27:35 GMT



You call them.


It's just a way to associate arbitrary information with a browser
instance. WebBrowser maintains a collection of name=value pairs,
initially empty. PutProperty adds or changes a value in this collection,
GetProperty looks it up.

For example, if you have a BHO and a deskband components loaded into the
same IE instance, they can use this mechanism to discover each other and
to cooperate.
--
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

webbrowser_ctl >> How to use PutProperty and GetProperty

by Emily » Fri, 25 Feb 2005 10:15:01 GMT

Hi, Igor

Thank you for your reply.
But I still have some questions about these methods.


HRESULT GetProperty(
BSTR Property,
VARIANT *pvtValue
);

Is the first parameter of the GetProperty the name of the components loaded
in the same IE?
And Where could I find the information of the collection of name=value
pairs which the WebBrowser maintains?
Really thank you so much.

Emily




"Igor Tandetnik" < XXXX@XXXXX.COM > :% XXXX@XXXXX.COM ...

webbrowser_ctl >> How to use PutProperty and GetProperty

by mayayana » Fri, 25 Feb 2005 13:45:06 GMT

The first parameter is the name of the property:

AddressBar, Application, Busy, Container, Document, FullName, FullScreen,
Height, HWND, Left, LocationName, LocationURL, MenuBar, Name, Offline,
Parent, Path, ReadyState, RegisterAsBrowser, RegisterAsDropTarget,
Resizable, Silent, StatusBar, StatusText, TheaterMode, ToolBar, Top,
TopLevelContainer, Type, Visible, Width



XXXX@XXXXX.COM
For return email remove XX and YY.
_____________________________


loaded
:% XXXX@XXXXX.COM ...


and
initially
GetProperty

webbrowser_ctl >> How to use PutProperty and GetProperty

by Emily » Fri, 25 Feb 2005 15:12:46 GMT

he following is the code which I test:

VARIANT vaProperty;
CComBSTR bstrProperty("AddressBar");
HRESULT hr = m_pWebBrowser2->GetProperty(bstrProperty, &vaProperty);

The return value:
hr : S_OK
vaProperty: Empty

But the WebBrowser is showen its Address Bar.
Is it right about the return value which I got?
Is it right about my testing code?

I am really confued with it.

Please tell me more about the usage about these functions or where could I
get more information about these functions.
Really thank you so much.

Regards,
Emily




"mayayana" < XXXX@XXXXX.COM > :CXyTd.6600$ XXXX@XXXXX.COM ...



webbrowser_ctl >> How to use PutProperty and GetProperty

by mayayana » Fri, 25 Feb 2005 22:32:40 GMT

I use VB so my situation is a bit different, but
this may help:
In VB I don't know of any use for GetProperty
and PutProperty because the object properties
can be used directly. In other words, I don't need
to use GetProperty for LocationURL because I
can just use the syntax: WB.LocationURL.

The AddressBar seems to be a unique case.
A WB control has no address bar, so the property
is not relevant (I don't know what you mean when you
say that it's showing.)
According to MSDN, the WB control ignores the
AddressBar property. If I try to use it I get an odd result
in VB:

MsgBox WB.AddressBar
Boo = WB.GetProperty("AddressBar")
MsgBox Boo

Those should be two ways of doing the same thing, but
the first returns True and the second returns False!

In general, the properties and methods of a WB object
are the same as for an IE object. A WB is just an IE window.
(Again, that's a statement from the point of view of VB.
If you're using C++ (or .Net C-hash?) then the situation
could be different.

XXXX@XXXXX.COM
For return email remove XX and YY.
_____________________________
Emily < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
:CXyTd.6600$ XXXX@XXXXX.COM ...
FullScreen,
two
methods.
to



webbrowser_ctl >> How to use PutProperty and GetProperty

by Igor Tandetnik » Fri, 25 Feb 2005 23:13:30 GMT


The first parameter is an arbitrary string. The second parameter is an
arbitrary value associated with this string. You establish an
association by calling PutProperty("name", value). If you later call
GetProperty("name"), you get the same value back. If you call
GetProperty with a name that was not previously assigned with
PutProperty, you get an empty variant (VT_EMPTY) back.


In my previous message. This is all there is to it. No magic involved.
There are no "predefined" properties - whatever goes in with
PutProperty, can later be retrieved with GetProperty. That's it.
--
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

webbrowser_ctl >> How to use PutProperty and GetProperty

by Igor Tandetnik » Fri, 25 Feb 2005 23:14:39 GMT


GetProperty has nothing whatsoever to do with actual properties of
WebBrowser object.
--
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

webbrowser_ctl >> How to use PutProperty and GetProperty

by mayayana » Fri, 25 Feb 2005 23:45:14 GMT


Oh, I see. (Sorry, Emily.) The MSDN description is ambiguous:
"Retrieves the current value of a property associated
with the given object."
So the GetProperty and PutProperty are just holders
for values that one wants to store. I assume it must be
a variant value. I can't find any reference to what the
data's type can be.

webbrowser_ctl >> How to use PutProperty and GetProperty

by Igor Tandetnik » Sat, 26 Feb 2005 00:08:09 GMT


Any type that can be packed into a VARIANT.
--
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

Similar Threads

1. WebBrowser2 PutProperty issue with Vista and IE7

Hi,

I am calling BHO function from external app. All works fine, I am creating a 
reference to IDispatch and storing it as a property. Then handing a call in 
CWebBHO::Invoke. BHO implements IObjectWithSite and IDispatch. However there 
is a problem on Vista and IE7. Basically the IE crashes when the browser 
window is closed. The code is below. I tried to set the custom property to 
NULL (CWebBHO::ReferenceMe(true) by handling DISPID_ONQUIT but that does not 
fix it. I guess next step is to do debugging with symbols but anyways wanted 
to ask first. Building and compiling is done in VC6 on XP.

Anybody could shed a light on the problem?

TECH

///////// start code //////////
STDMETHODIMP CWebBHO::SetSite(IUnknown *pUnkSite)
{
    USES_CONVERSION; //CA2W is called
    HRESULT hr = S_OK;
    // Retrieve and store the IWebBrowser2 pointer
    m_spWebBrowser2 = pUnkSite;
    if (m_spWebBrowser2 == NULL)
      return E_INVALIDARG;
    // IConnectionPointerContainer pointer
    m_spCPC = m_spWebBrowser2;
    if (m_spCPC == NULL)
      return E_POINTER;
    // Registers the IE session to allow external call i
    hr = ReferenceMe(false);
    if (FAILED(hr))
       return S_FALSE
.......................

HRESULT CWebBHO::ReferenceMe(bool bRemove)
{
    BSTR bstrThisKey = SysAllocString(L"WebBHO_IDisp");
    VARIANT vThis;
    HRESULT hr = S_FALSE;
    if (!bRemove)
    {
        if (!m_spWebBrowser2)
        goto Cleanup;
        // Save this to a variant that will be referenced in IE Session
        VariantInit(&vThis);
        vThis.vt = VT_DISPATCH;
        vThis.pdispVal = static_cast<IDispatch*>(this);
        // Add our this pointer to IE session by adding a named property
        if (FAILED( m_spWebBrowser2->PutProperty(bstrThisKey, vThis) ))
            goto Cleanup;
    }
    else
    {
        VariantInit(&vThis);
        vThis.vt = VT_NULL;
        // Time to release, remove our reference
        if (FAILED( m_spWebBrowser2->PutProperty(bstrThisKey, vThis) ))
            goto Cleanup;
    }
    hr = S_OK;
Cleanup:
    VariantClear(&vThis);
    SysFreeString(bstrThisKey);
    return hr;
} 


2. Initial value of control input never sent in a form submitted using post

3. Internet Browser - Emailing from html using emailto:

Hi,

I have a system were people are able to select companies they wish to 
contact from a list.  The system then puts together a string of emails from 
all of the selected contacts at each company in order to feed it through to 
Outlook via the mailto: function in html.  ie.  
mailto:?bcc= XXXX@XXXXX.COM ; XXXX@XXXXX.COM ; XXXX@XXXXX.COM ....etc
Now this works fine up until this string reaches 2048 characters in length 
(MAX availabe URL Length) - then the link starts to fail - first with a 
message 'no default email account configured' and nothing happening at all, 
etc.
I would still like for people to be able to use their own email system to 
email contacts - rather than create a built-in emailer page (for 
signature/attachment possibilities).  Is there another way of feeding the 
emails to outlook bcc field?

Many thanks

TK

4. Launching App from Browser using XML-based file in link

5. Right most text being cut off when using padding and width in a table

I have some html (se below) which contains table inside tables with div
tags.

When it is resized smaller the right-most text "inc" turns into "in" with
only a part of the "n" visible.

Any ideas on how to fix this ?

code:
<table style="width: 100.0%;" cellspacing="0" cellpadding="0"
style="background-color: black;" border="">
<tr><td><div style="background-color: yellow; padding-right: 5px;
padding-left: 5px; border: 1">
 <div style="background-color: red; padding-right: 5px; padding-left: 5px;
border: 1">
  <table id="layout" cellspacing="0" cellpadding="0" style="width: 100.0%;
background-color: blue; border: 1">
<tr><td>

<table class="tableContainer" cellpadding="0" cellspacing="0" border="0">
<tr><td class="tableContent" colspan="2"><table class="rr00004mainTable"
border="0" cellspacing="0" cellpadding="0">
 <TBODY>
 <TR class="rr00004tableRow">
 <TD >Clothes</TD><TD>Eclipse Clothing</TD><TD>220100100002</TD><TD>Clothes
& Shoes</TD><TD>2000 Black/Red</TD>
 <TD>United States</TD><TD class="rr00004c6">1303</TD><TD
class="rr00004c7">Eclipse Inc</TD></TR>
 </TBODY>
</table></td></tr></table>

</tr></td></table></div></div></tr></td></table>

Thanks
Ren


6. Showing all spaces without using the  

7. Showing/Hiding Attributes of the Window Using Javascript

I would like to hide certain parts of a window such and the menu bar, 
toolbar, status bar, etc. However, the following properties of the window 
object give an error saying they do not exist in Internet Explorer (whether 
any of them exist in Netscape, I don't know yet since I haven't tested in 
Netscape yet):

window.locationbar.visible=false;
window.menubar.visible=false;
window.personalbar.visible=false;
window.scrollbars.visible=false;
window.toolbar.visible=false;
window.statusbar.visible=false;

Because most of these attributes can be set when a window is opened using 
the window.open method, assuming that it is not stopped by a popup blocker, 
I would hope that they could be set individually as well. However, as of 
this point, I do not know of any way to do this. Any help would be 
appreciated. Thanks.
-- 
Nathan Sokalski
 XXXX@XXXXX.COM 
www.nathansokalski.com 


8. FTP access using Windows Internet Explorer 7