How does the control developed by ATL get parameters in a web page

zhaozj2021-02-16  64

Now extracting parameters, MYURL as an example:

1. Class ATL_NO_VTABLE CXXX:

...

Public IPERSISTPROPERTYBAGIMPL

2. Add attributes, MyURL, in the IDL file

[Propget, ID (16), Helpstring ("Property MyURL")] HRESULT MyURL ([OUT, RETVAL] BSTR * PVAL); [PropPut, ID (16), Helpstring ("Property MyURL")] HRESULT MYURL ([IN ] BSTR newval

3. Begin_prop_map (cxxx) Prop_Data_ENTRY ("_ CX", M_SIEEXTENT.CX, VT_UI4) Prop_Data_ENTRY ("_ cy", m_sizeextent.cy, vt_ui4)

Prop_ENTRY ("MyURL", 16, CLSID_NULL) // Example Entries // Prop_ENTRY ("Property Description", Dispid, CLSID) // Prop_page (CLSID_STOCKCOLORPAGE) End_prop_map ()

Note that in PROP_ENTRY ("MyURL", 16, CLSID_NUL) ID (16), its own correspondence

4. Add type variables BOOL M_BREQUIRESSAVE; // This is what IPersistPropertyBagImpl needs

CCOMBSTR M_BSTRMYURL;

5. stdmethodimp cxxx :: get_myurl (bstr * pval) {// Todo: add your importation code here * pval = m_bstrmyurl.copy (); return s_ok;}

STDMETHODIMP CXXX :: PUT_MYURL (BSTR newval) {// Todo: add your us: add your importation code here m_bstrMyurl.empty ();

m_bstrmyurl = newval; return s_ok;}

6. Online

转载请注明原文地址:https://www.9cbs.com/read-17864.html

New Post(0)