Click here to Skip to main content
15,905,607 members
Home / Discussions / COM
   

COM

 
AnswerRe: FTP using TAPI ??? ( anyone to enlighten me!!!) Pin
JonEngle26-Oct-05 18:31
JonEngle26-Oct-05 18:31 
QuestionHelp Please? Pin
Wail A.Salem22-Oct-05 13:58
Wail A.Salem22-Oct-05 13:58 
AnswerRe: Help Please? Pin
Christian Graus23-Oct-05 19:39
protectorChristian Graus23-Oct-05 19:39 
QuestionWhich COM interface to export an object into a particular format Pin
Carsten Leue21-Oct-05 22:10
Carsten Leue21-Oct-05 22:10 
AnswerRe: Which COM interface to export an object into a particular format Pin
Vi223-Oct-05 18:33
Vi223-Oct-05 18:33 
GeneralRe: Which COM interface to export an object into a particular format Pin
Carsten Leue23-Oct-05 22:08
Carsten Leue23-Oct-05 22:08 
GeneralRe: Which COM interface to export an object into a particular format Pin
Vi224-Oct-05 0:10
Vi224-Oct-05 0:10 
GeneralRe: Which COM interface to export an object into a particular format Pin
Carsten Leue24-Oct-05 5:14
Carsten Leue24-Oct-05 5:14 
Hi Vita.

I guess I want to make a different point. The COM object that I have represents a graphic with an internal binary representation that is specifc to my application. I want to export this graphic to JPEG into a stream (or a number of other formats). The JPEG representation is not enough to recreate my graphics, so it is not equivalent to persisting my object, I just want to export it to a stream (not to a file), e.g. to pipe it into another filter stream or to return it as a response to an http request.

Somewhat like this (pseudocode):

<br />
IUnknown* pMyObject = ...<br />
IStream* pOut = ...  // E.g. via SHCreateStreamOnFile(...)<br />
<br />
IExport* pExport;<br />
pMyObject->QueryInterface(IID_IExport, (LPVOID*) &pExport);<br />
<br />
LPCWSTR mimeType = L"image/jpeg";<br />
IBindCtx* pJpegOptions = ...<br />
IPersistStream* pPersStream;<br />
pExport->get_Persister(&pPersStream, mimeType, pJpegOptions);<br />
<br />
pPersStream->Save(pOut, FALSE);<br />
<br />
// export the same instance into a different format<br />
<br />
mimeType = L"application/postscript";<br />
IBindCtx* pPostscriptOptions = ...<br />
pExport->get_Persister(&pPersStream, mimeType, pPostscriptOptions );<br />
<br />
pPersStream->Save(pOut, FALSE);<br />


I wonder if this is the right programming pattern to export an object and if yes, is there a standard interface that corresponds to the IExport in my pseudocode?

I considered using IPersistMoniker like this:

<br />
IUnknown* pMyObject = ...<br />
<br />
IPersistMoniker* pPersMon;<br />
pMyObject->QueryInterface(IID_IPersistMoniker, (LPVOID*) &pPersMon);<br />
<br />
IMoniker* pOutMon;<br />
CreateFileMoniker(L"test.jpg", &pOutMon);<br />
IBindCtx* pJpegOptions = ...<br />
pPersMon->Save(pOutMon, pJpegOptions, FALSE)<br />


Is this the right pattern?
General[Message Deleted] Pin
Carsten Leue24-Oct-05 5:14
Carsten Leue24-Oct-05 5:14 
Questionsuggest a good book for COM Pin
einishant21-Oct-05 3:01
einishant21-Oct-05 3:01 
AnswerRe: suggest a good book for COM Pin
Carsten Leue21-Oct-05 22:40
Carsten Leue21-Oct-05 22:40 
GeneralRe: suggest a good book for COM Pin
einishant22-Oct-05 2:05
einishant22-Oct-05 2:05 
GeneralRe: suggest a good book for COM Pin
Gizzo25-Oct-05 6:59
Gizzo25-Oct-05 6:59 
Questionnumnericupdown problem Pin
Mridang Agarwalla20-Oct-05 9:57
Mridang Agarwalla20-Oct-05 9:57 
Questionwindows update Pin
Mridang Agarwalla20-Oct-05 9:54
Mridang Agarwalla20-Oct-05 9:54 
QuestionIdentity impersonation per page - possible? Pin
minette20-Oct-05 0:08
minette20-Oct-05 0:08 
QuestionGoing insane over this Pin
odiesback19-Oct-05 5:44
odiesback19-Oct-05 5:44 
AnswerRe: Going insane over this Pin
Roger Stoltz20-Oct-05 0:07
Roger Stoltz20-Oct-05 0:07 
GeneralRe: Going insane over this Pin
odiesback20-Oct-05 7:04
odiesback20-Oct-05 7:04 
GeneralRe: Going insane over this Pin
Roger Stoltz24-Oct-05 22:22
Roger Stoltz24-Oct-05 22:22 
GeneralRe: Going insane over this Pin
odiesback25-Oct-05 5:04
odiesback25-Oct-05 5:04 
AnswerRe: Going insane over this Pin
Roger Stoltz25-Oct-05 12:03
Roger Stoltz25-Oct-05 12:03 
GeneralRe: Going insane over this Pin
odiesback25-Oct-05 13:46
odiesback25-Oct-05 13:46 
GeneralRe: Going insane over this Pin
Roger Stoltz25-Oct-05 21:41
Roger Stoltz25-Oct-05 21:41 
GeneralRe: Going insane over this Pin
odiesback26-Oct-05 5:36
odiesback26-Oct-05 5:36 

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.