KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
OK, so I couldn't really think of an apropos title that summarizes this. The IPrintPipelinePropertyBag interface has the method AddProperty which aptly enough "adds a property to a property bag." http://msdn.microsoft.com/en-us/library/aa506384.aspx AddProperty( [in, string] const wchar_t *pszName, [in] const VARIANT *pVar ); We use the following code to add a string to the property bag. CComVariant varProperty = CComBSTR(someString); pPrintPropertyBag->AddProperty(L"SOME_PROPERTY", &varFilename); It's pretty obvious, though, that the CComBSTR and CComVariant that is created goes out of scope after a while. I'm not sure if the PropertyBag handles the string and makes its own copy. Since we can store all kinds of stuff inside a VARIANT, this shouldn't be the case. Assuming the string isn't handled, my question is, what is the pattern for doing this in COM? How should I pass a VARIANT that contains an allocated string, make that string available for other threads even if the thread that called AddProperty died first, and de-allocate the string properly?
Tags (comma-separated)
Save Edits
Cancel