Hi Dave, but why would "CreateCompatibleDC" return "File already exists"? The method "CreateMetaFile", that actually creates the file, completes successfully. I understand that CreateEnhMetaFile exists, but need to be able to create WMF file legacy reasons. Regards Carsten
Carsten Leue
Posts
-
CreateMetaFile on Win7 64bit -
CreateMetaFile on Win7 64bitI have test code that embeds a bitmap in a WMF metafile and creates a memory DC for that purpose. The code works fine on XP but fails on Windows7 64bit. The minimum sniplet to recreate the problem is:
HDC hDC = ::CreateMetaFile(\_T("test.wmf")); HDC memDC = ::CreateCompatibleDC(hDC); \_ASSERTE(memDC != NULL); ::DeleteDC(memDC); HMETAFILE hMeta = ::CloseMetaFile(hDC); ::DeleteMetaFile(hMeta);
CreateCompatibleDC fails and GetLastError returns 183. Is the creation of WMF files no longer supported on Windows7? The corresponding CreateEnhMetaFile method works fine. Thanks Carsten
-
while (*p++);It's a bummer! You are correct. The loop ends if
p
points to the end of the string butp
is still incremented. Carsten -
while (*p++);If p initially points to a character string then after
while(*p++);
p points to the0
character that terminates the string. So it is semantically the same asp = p + _tcslen(p);
-
IImageDecodeEventSinkDoes anybody know where I can find information on the
IImageDecodeEventSink
and theIImageDecodeFilter
interfaces that are declared inocmm.h
? Best regards Carsten -
SOAP via stdin/stdout - how?I would like to make a soap call that should work the following way: For every method invocation 1. the client starts the server executable 2. the client pipes the input message to stdin of the server process 3. the server reads stdin, decodes the soap message and processes it 4. the output message is written to stdout by the server 5. the client decodes the message and continues Ideally it would be possible to define a SOAP binding in the WSDL that define the executable to be started instead of specifying a URL. Is there something like a predefined EXE-binding in WSDL? Are there SOAP frameworks that allow you to pipe SOAP via stdin/stdout instead of making a http request? Best regards Carsten
-
Which COM interface to export an object into a particular formatHi 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):
IUnknown* pMyObject = ... IStream* pOut = ... // E.g. via SHCreateStreamOnFile(...) IExport* pExport; pMyObject->QueryInterface(IID_IExport, (LPVOID*) &pExport); LPCWSTR mimeType = L"image/jpeg"; IBindCtx* pJpegOptions = ... IPersistStream* pPersStream; pExport->get_Persister(&pPersStream, mimeType, pJpegOptions); pPersStream->Save(pOut, FALSE); // export the same instance into a different format mimeType = L"application/postscript"; IBindCtx* pPostscriptOptions = ... pExport->get_Persister(&pPersStream, mimeType, pPostscriptOptions ); pPersStream->Save(pOut, FALSE);
I wonder if this is the right programming pattern to export an object and if yes, is there a standard interface that corresponds to theIExport
in my pseudocode? I considered usingIPersistMoniker
like this:IUnknown* pMyObject = ... IPersistMoniker* pPersMon; pMyObject->QueryInterface(IID_IPersistMoniker, (LPVOID*) &pPersMon); IMoniker* pOutMon; CreateFileMoniker(L"test.jpg", &pOutMon); IBindCtx* pJpegOptions = ... pPersMon->Save(pOutMon, pJpegOptions, FALSE)
Is this the right pattern? -
Which COM interface to export an object into a particular format[Message Deleted]
-
Which COM interface to export an object into a particular formatHi Vita. Right, but how does the interface allow me to export my object? I would guess the correct format by evaluating the file extension, but that won't work if want to stream the content instead of writing it to a file (IPersistStream). Also IPersistFile does not allow me to pass extra information to configure the export process, such as target width/height of an exported bitmap or the compression ratio for JPEG.
-
Accessing COM componenets from JavaThe eclipse project has COM support built in, so you could look at using these eclipse libraries. Then there is the Java-to-XPCOM Bridge project (XPCOM are essentially COM interfaces independent of the win32 headers) http://www.mozilla.org/projects/blackwood/connect/ And IBM has bridge2java which worked fine for me http://www.alphaworks.ibm.com/tech/bridge2java Best regards Carsten
-
suggest a good book for COMDon Box' books are definitely the best in my opinion. Essential COM http://www.amazon.com/gp/product/0201634465/104-1873800-1887156?v=glance&n=283155&n=507846&s=books&v=glance Effective COM http://www.amazon.com/gp/product/0201379686/104-1873800-1887156?v=glance&n=283155&n=507846&s=books&v=glance Carsten
-
Which COM interface to export an object into a particular formatI would like my COM object to expose the functionality to export itself into different binary representations into an output stream. E.g. to render itself into a stream as PDF or as JPEG, etc. The functionality itself is already available, but I don't know how to expose this function in terms of standard COM interfaces. I looked at the IPersistXXX interfaces but they don't allow to specify the target format but assume that the format is inherent to the object. Also for every output format there are potentially format dependent options that need to be passed in. IPersistMoniker looked promising but I am not sure if the intent of this interface is the export into different formats. I would like to reuse existing COM interfaces if possible rather than defining my own interface. What do you recommend? Best regards Carsten