Click here to Skip to main content
16,012,223 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CControlBar won't go away Pin
Derek Waters6-Feb-02 13:02
Derek Waters6-Feb-02 13:02 
GeneralBig/Small Tic marks on CSliderCtrl Pin
Jerry Wang6-Feb-02 4:38
Jerry Wang6-Feb-02 4:38 
GeneralRe: Big/Small Tic marks on CSliderCtrl Pin
Mazdak6-Feb-02 5:00
Mazdak6-Feb-02 5:00 
GeneralRe: Big/Small Tic marks on CSliderCtrl Pin
Jerry Wang6-Feb-02 5:10
Jerry Wang6-Feb-02 5:10 
QuestionActiveX (ATL) question? Pin
jancsi6-Feb-02 4:30
jancsi6-Feb-02 4:30 
AnswerRe: ActiveX (ATL) question? Pin
alex.barylski6-Feb-02 5:16
alex.barylski6-Feb-02 5:16 
AnswerRe: ActiveX (ATL) question? Pin
Paul M Watt6-Feb-02 8:40
mentorPaul M Watt6-Feb-02 8:40 
GeneralRe: ActiveX (ATL) question? Pin
Paul M Watt7-Feb-02 10:35
mentorPaul M Watt7-Feb-02 10:35 
You are not bothering me, I like to help.

Anyways, here are some segments of code from a control that I wrote. First declare the property get_ and put_ functions in idl.

<br />
	[<br />
		object,<br />
		uuid(...),<br />
		dual,<br />
		helpstring("IHTMLInfoCtl Interface"),<br />
		pointer_default(unique)<br />
	]<br />
	interface IHTMLInfoCtl : IDispatch<br />
	{<br />
		[propput, id(0)]<br />
		HRESULT URL([in]BSTR pVal);<br />
		[propget, id(0)]<br />
		HRESULT URL([out,retval]BSTR* newVal);<br />
	};<br />


Next implement these functions in your class interface.
The key to tying the data together is deriving your ATL object from the IPersistStream interface, then providing one of the IPersist implementations. I used IPersistePropertyBagImpl and it
works fine. I am not sure, but I think that One of the IPersistxxx classes that I have declared may not need to be declared, but this code works for me.

<br />
class ATL_NO_VTABLE CHTMLInfoCtl : <br />
	public CComObjectRootEx<CComSingleThreadModel>,<br />
	public CComCoClass<CHTMLInfoCtl, &CLSID_HTMLInfoCtl>,<br />
        ...<br />
	public IPersistStreamInitImpl<CHTMLInfoCtl>,<br />
	public IPersistStorageImpl<CHTMLInfoCtl>,<br />
        ...<br />
	public IPersistPropertyBagImpl<CHTMLInfoCtl>,<br />
        ...<br />
{<br />
<br />
public:<br />
	CHTMLInfoCtl();<br />
	~CHTMLInfoCtl();<br />
<br />
        ...<br />
<br />


One final thing, add the IPersist entries to your COM map here.

<br />
BEGIN_COM_MAP(CHTMLInfoCtl)<br />
	COM_INTERFACE_ENTRY(IHTMLInfoCtl)<br />
        ...<br />
	COM_INTERFACE_ENTRY(IPersistStorage)<br />
	COM_INTERFACE_ENTRY(IPersistStreamInit)<br />
	COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)<br />
	COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersistPropertyBag)<br />
	COM_INTERFACE_ENTRY(IPersistPropertyBag)<br />
END_COM_MAP()<br />
<br />
BEGIN_PROP_MAP(CHTMLInfoCtl)<br />
	PROP_ENTRY("URL", 0, CLSID_NULL)<br />
END_PROP_MAP()<br />
<br />
// IHTMLInfoCtl<br />
public:<br />
	STDMETHOD(get_URL)(BSTR *pVal);<br />
	STDMETHOD(put_URL)(BSTR newURL);<br />
private:<br />
	CComBSTR	m_bstrURL;<br />
};<br />


let me know if you have other questions.
QuestionInput Reading? Pin
6-Feb-02 4:21
suss6-Feb-02 4:21 
AnswerRe: Input Reading? Pin
Carlos Antollini6-Feb-02 4:29
Carlos Antollini6-Feb-02 4:29 
AnswerRe: Input Reading? Pin
Carlos Antollini6-Feb-02 4:29
Carlos Antollini6-Feb-02 4:29 
AnswerRe: Input Reading? Pin
Nish Nishant6-Feb-02 4:40
sitebuilderNish Nishant6-Feb-02 4:40 
AnswerRe: Input Reading? Pin
lucy6-Feb-02 6:48
lucy6-Feb-02 6:48 
QuestionCStatusBar trick? Pin
Fredrik Skog6-Feb-02 4:01
Fredrik Skog6-Feb-02 4:01 
AnswerRe: CStatusBar trick? Pin
6-Feb-02 4:32
suss6-Feb-02 4:32 
GeneralRe: CStatusBar trick? Pin
Fredrik Skog6-Feb-02 23:32
Fredrik Skog6-Feb-02 23:32 
GeneralListView Notifications Pin
Aaron Schaefer6-Feb-02 3:46
Aaron Schaefer6-Feb-02 3:46 
GeneralRe: ListView Notifications Pin
Mazdak6-Feb-02 4:18
Mazdak6-Feb-02 4:18 
GeneralRe: ListView Notifications Pin
Aaron Schaefer6-Feb-02 6:37
Aaron Schaefer6-Feb-02 6:37 
GeneralRe: ListView Notifications Pin
Mazdak6-Feb-02 7:59
Mazdak6-Feb-02 7:59 
GeneralRe: ListView Notifications Pin
Aaron Schaefer6-Feb-02 8:14
Aaron Schaefer6-Feb-02 8:14 
GeneralSQL Pin
6-Feb-02 3:14
suss6-Feb-02 3:14 
GeneralRe: SQL Pin
Mazdak6-Feb-02 3:13
Mazdak6-Feb-02 3:13 
Generalstring tables Pin
Mel Stober6-Feb-02 3:12
Mel Stober6-Feb-02 3:12 
GeneralRe: string tables Pin
Joaquín M López Muñoz6-Feb-02 3:26
Joaquín M López Muñoz6-Feb-02 3:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.