Using "printto" verb on .HTML file types without Print dialog showing

  • Thread starter Thread starter Robert Freas
  • Start date Start date
R

Robert Freas

Hi,

Does anyone know how to use the "printto" verb with ShellExecute() on
files of type .HTML without the Printer dialog coming up? I've tried
multiple variations on specifying the printer to use in the printo
command, but no luck. I can get this to work with a file of type
..TXT, however, I do see Notepad flash open for a second in the
background. How does the Windows Fax Service accomplish this? It is
able to send any document that supports the "printto" verb to the Fax
printer without anything ever showing up--no Printer dialogs, no
applications flashing open, etc. Does anyone know how to accomplish
this programmatically? I have seen many postings on this problem, but
no answers as to how to work around it.

Additionally, Manoj Jain [MSFT] ([email protected]) said he
had sample code for demonstrating how to programmatically print
multiple documents to a single TIF file. Does anyone have this or
know what he was referring to??

Thanks for any help,

Rob
 
Hi,
I will send the code by Monday - sorry about the delay.

--
Thank you, Manoj
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no
rights.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.'
 
Here's the code for doing this for all image types like bmps(we tested for
this), jpegs - it has not been made generic, that should be easy to achieve
that for all images. I will try to get the same for all documents and post
it soon enough.

This has been abstracted into a class - CGdiHelper.. The SaveImage takes the
following parameters -
1) szFileInPath - the file path to the in files like c:\temp\image
2) ulNumImagess - number of images to merge.
3) szFileExtension - the extension to work with. Let's assume bmp, then if
ulNumImages is 2, the filenames should be c:\temp\image0.bmp,
c:\temp\image1.bmp, c:\temp\image2.bmp
The rest parameters for out parameters - ie to get the merged tiff file
Sorry about the formatting
#include "stdafx.h"

#include "Scan2FaxDlg.h"

CGdiHelper::CGdiHelper()

{

// Initialize GDI+.

GdiplusStartup(&m_gdiplusToken, &m_gdiplusStartupInput, NULL);

}

CGdiHelper::~CGdiHelper()

{

GdiplusShutdown(m_gdiplusToken);

}

HRESULT CGdiHelper::SaveImage(WCHAR *szFileInPath, WCHAR *szFileExtension,
ULONG ulNumImages, WCHAR *szFileOutPath, ULONG ulFileOutLen)

{

HRESULT hr = S_OK;

EncoderParameters encoderParameters;

WCHAR szImageFileName[FILE_PATH_LEN + FILE_EXTENSION_LEN + 1];

ULONG parameterValue, i;

Status stat;

ULONG ulNumImagesAllocated;


if (!szFileInPath || !szFileExtension || !ulNumImages || !szFileOutPath)

return E_INVALIDARG;

// An EncoderParameters object has an array of

// EncoderParameter objects. In this case, there is only

// one EncoderParameter object in the array.

encoderParameters.Count = 1;

// Initialize the one EncoderParameter object.

encoderParameters.Parameter[0].Guid = EncoderSaveFlag;

encoderParameters.Parameter[0].Type = EncoderParameterValueTypeLong;

encoderParameters.Parameter[0].NumberOfValues = 1;

encoderParameters.Parameter[0].Value = &parameterValue;

// Get the CLSID of the TIFF encoder.

CLSID encoderClsid;

GetEncoderClsid(L"image/tiff", &encoderClsid);

//Create the desired number of image objects

Image **ppMultiFrame = new Image*[ulNumImages];

if (NULL == ppMultiFrame)

return E_OUTOFMEMORY;

_snwprintf(szFileOutPath, ulFileOutLen-1,

L"%s.tif", szFileInPath);

for (i = 0; i < ulNumImages; i++)

{

_snwprintf(szImageFileName, ARRAY_SIZE(szImageFileName)-1,

L"%s%d.%s", szFileInPath, i, szFileExtension);

ppMultiFrame = new Image(szImageFileName);

if (NULL == ppMultiFrame)

{

hr = E_OUTOFMEMORY;

break;

}

//if this is the first page, create the multi paged file

if (i == 0)

{

// Save the first page (frame).

parameterValue = EncoderValueMultiFrame;

stat = ppMultiFrame->Save(szFileOutPath, &encoderClsid,
&encoderParameters);

if(stat != Ok)

{

hr = E_FAIL;

break;

}

}

else

{

// Save the first page (frame).

parameterValue = EncoderValueFrameDimensionPage;

stat = ppMultiFrame[0]->SaveAdd(ppMultiFrame, &encoderParameters);

}

}

ulNumImagesAllocated = i;


// Close the multiframe file if at least the first image is allocated.

if (ulNumImagesAllocated > 0)

{

parameterValue = EncoderValueFlush;

stat = ppMultiFrame[0]->SaveAdd(&encoderParameters);

if(stat != Ok)

hr = E_FAIL;

}

for (i = 0; i < ulNumImagesAllocated; i++)

{

delete ppMultiFrame;

}

delete ppMultiFrame;

return hr;

}

int CGdiHelper::GetEncoderClsid(const WCHAR* format, CLSID* pClsid)

{

UINT num = 0; // number of image encoders

UINT size = 0; // size of the image encoder array in bytes

ImageCodecInfo* pImageCodecInfo = NULL;

GetImageEncodersSize(&num, &size);

if(size == 0)

return -1; // Failure

pImageCodecInfo = (ImageCodecInfo*)(malloc(size));

if(pImageCodecInfo == NULL)

return -1; // Failure

GetImageEncoders(num, size, pImageCodecInfo);

for(UINT j = 0; j < num; ++j)

{

if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )

{

*pClsid = pImageCodecInfo[j].Clsid;

free(pImageCodecInfo);

return j; // Success

}

}

free(pImageCodecInfo);

return -1; // Failure

}


--
Thank you, Manoj
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no
rights.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.'
Manoj Jain said:
Hi,
I will send the code by Monday - sorry about the delay.

--
Thank you, Manoj
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no
rights.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.'
Robert Freas said:
Hi,

Does anyone know how to use the "printto" verb with ShellExecute() on
files of type .HTML without the Printer dialog coming up? I've tried
multiple variations on specifying the printer to use in the printo
command, but no luck. I can get this to work with a file of type
.TXT, however, I do see Notepad flash open for a second in the
background. How does the Windows Fax Service accomplish this? It is
able to send any document that supports the "printto" verb to the Fax
printer without anything ever showing up--no Printer dialogs, no
applications flashing open, etc. Does anyone know how to accomplish
this programmatically? I have seen many postings on this problem, but
no answers as to how to work around it.

Additionally, Manoj Jain [MSFT] ([email protected]) said he
had sample code for demonstrating how to programmatically print
multiple documents to a single TIF file. Does anyone have this or
know what he was referring to??

Thanks for any help,

Rob
 
Manoj,

Thanks much for the reply!

Did you say you were going to post the code for doing this for any
document type in Windows that supports "printto"? That would be
precisely what I want to do--as opposed to just using this for image
file types.

Thanks much,

Rob

Manoj Jain said:
Here's the code for doing this for all image types like bmps(we tested for
this), jpegs - it has not been made generic, that should be easy to achieve
that for all images. I will try to get the same for all documents and post
it soon enough.

This has been abstracted into a class - CGdiHelper.. The SaveImage takes the
following parameters -
1) szFileInPath - the file path to the in files like c:\temp\image
2) ulNumImagess - number of images to merge.
3) szFileExtension - the extension to work with. Let's assume bmp, then if
ulNumImages is 2, the filenames should be c:\temp\image0.bmp,
c:\temp\image1.bmp, c:\temp\image2.bmp
The rest parameters for out parameters - ie to get the merged tiff file
Sorry about the formatting
#include "stdafx.h"

#include "Scan2FaxDlg.h"

CGdiHelper::CGdiHelper()

{

// Initialize GDI+.

GdiplusStartup(&m_gdiplusToken, &m_gdiplusStartupInput, NULL);

}

CGdiHelper::~CGdiHelper()

{

GdiplusShutdown(m_gdiplusToken);

}

HRESULT CGdiHelper::SaveImage(WCHAR *szFileInPath, WCHAR *szFileExtension,
ULONG ulNumImages, WCHAR *szFileOutPath, ULONG ulFileOutLen)

{

HRESULT hr = S_OK;

EncoderParameters encoderParameters;

WCHAR szImageFileName[FILE_PATH_LEN + FILE_EXTENSION_LEN + 1];

ULONG parameterValue, i;

Status stat;

ULONG ulNumImagesAllocated;


if (!szFileInPath || !szFileExtension || !ulNumImages || !szFileOutPath)

return E_INVALIDARG;

// An EncoderParameters object has an array of

// EncoderParameter objects. In this case, there is only

// one EncoderParameter object in the array.

encoderParameters.Count = 1;

// Initialize the one EncoderParameter object.

encoderParameters.Parameter[0].Guid = EncoderSaveFlag;

encoderParameters.Parameter[0].Type = EncoderParameterValueTypeLong;

encoderParameters.Parameter[0].NumberOfValues = 1;

encoderParameters.Parameter[0].Value = &parameterValue;

// Get the CLSID of the TIFF encoder.

CLSID encoderClsid;

GetEncoderClsid(L"image/tiff", &encoderClsid);

//Create the desired number of image objects

Image **ppMultiFrame = new Image*[ulNumImages];

if (NULL == ppMultiFrame)

return E_OUTOFMEMORY;

_snwprintf(szFileOutPath, ulFileOutLen-1,

L"%s.tif", szFileInPath);

for (i = 0; i < ulNumImages; i++)

{

_snwprintf(szImageFileName, ARRAY_SIZE(szImageFileName)-1,

L"%s%d.%s", szFileInPath, i, szFileExtension);

ppMultiFrame = new Image(szImageFileName);

if (NULL == ppMultiFrame)

{

hr = E_OUTOFMEMORY;

break;

}

//if this is the first page, create the multi paged file

if (i == 0)

{

// Save the first page (frame).

parameterValue = EncoderValueMultiFrame;

stat = ppMultiFrame->Save(szFileOutPath, &encoderClsid,
&encoderParameters);

if(stat != Ok)

{

hr = E_FAIL;

break;

}

}

else

{

// Save the first page (frame).

parameterValue = EncoderValueFrameDimensionPage;

stat = ppMultiFrame[0]->SaveAdd(ppMultiFrame, &encoderParameters);

}

}

ulNumImagesAllocated = i;


// Close the multiframe file if at least the first image is allocated.

if (ulNumImagesAllocated > 0)

{

parameterValue = EncoderValueFlush;

stat = ppMultiFrame[0]->SaveAdd(&encoderParameters);

if(stat != Ok)

hr = E_FAIL;

}

for (i = 0; i < ulNumImagesAllocated; i++)

{

delete ppMultiFrame;

}

delete ppMultiFrame;

return hr;

}

int CGdiHelper::GetEncoderClsid(const WCHAR* format, CLSID* pClsid)

{

UINT num = 0; // number of image encoders

UINT size = 0; // size of the image encoder array in bytes

ImageCodecInfo* pImageCodecInfo = NULL;

GetImageEncodersSize(&num, &size);

if(size == 0)

return -1; // Failure

pImageCodecInfo = (ImageCodecInfo*)(malloc(size));

if(pImageCodecInfo == NULL)

return -1; // Failure

GetImageEncoders(num, size, pImageCodecInfo);

for(UINT j = 0; j < num; ++j)

{

if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )

{

*pClsid = pImageCodecInfo[j].Clsid;

free(pImageCodecInfo);

return j; // Success

}

}

free(pImageCodecInfo);

return -1; // Failure

}


--
Thank you, Manoj
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no
rights.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.'
Manoj Jain said:
Hi,
I will send the code by Monday - sorry about the delay.

--
Thank you, Manoj
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no
rights.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.'
Robert Freas said:
Hi,

Does anyone know how to use the "printto" verb with ShellExecute() on
files of type .HTML without the Printer dialog coming up? I've tried
multiple variations on specifying the printer to use in the printo
command, but no luck. I can get this to work with a file of type
.TXT, however, I do see Notepad flash open for a second in the
background. How does the Windows Fax Service accomplish this? It is
able to send any document that supports the "printto" verb to the Fax
printer without anything ever showing up--no Printer dialogs, no
applications flashing open, etc. Does anyone know how to accomplish
this programmatically? I have seen many postings on this problem, but
no answers as to how to work around it.

Additionally, Manoj Jain [MSFT] ([email protected]) said he
had sample code for demonstrating how to programmatically print
multiple documents to a single TIF file. Does anyone have this or
know what he was referring to??

Thanks for any help,

Rob
 
Hi,
I did not get the time to complete this. But it should be straightforward
following the method suggested. Have you given that try? If yes, can you
share the code and I can take a look at it and reply.

--
Thank you, Manoj
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no
rights.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.'
Robert Freas said:
Manoj,

Thanks much for the reply!

Did you say you were going to post the code for doing this for any
document type in Windows that supports "printto"? That would be
precisely what I want to do--as opposed to just using this for image
file types.

Thanks much,

Rob

"Manoj Jain [MSFT]" <[email protected]> wrote in message
Here's the code for doing this for all image types like bmps(we tested for
this), jpegs - it has not been made generic, that should be easy to achieve
that for all images. I will try to get the same for all documents and post
it soon enough.

This has been abstracted into a class - CGdiHelper.. The SaveImage takes the
following parameters -
1) szFileInPath - the file path to the in files like c:\temp\image
2) ulNumImagess - number of images to merge.
3) szFileExtension - the extension to work with. Let's assume bmp, then if
ulNumImages is 2, the filenames should be c:\temp\image0.bmp,
c:\temp\image1.bmp, c:\temp\image2.bmp
The rest parameters for out parameters - ie to get the merged tiff file
Sorry about the formatting
#include "stdafx.h"

#include "Scan2FaxDlg.h"

CGdiHelper::CGdiHelper()

{

// Initialize GDI+.

GdiplusStartup(&m_gdiplusToken, &m_gdiplusStartupInput, NULL);

}

CGdiHelper::~CGdiHelper()

{

GdiplusShutdown(m_gdiplusToken);

}

HRESULT CGdiHelper::SaveImage(WCHAR *szFileInPath, WCHAR *szFileExtension,
ULONG ulNumImages, WCHAR *szFileOutPath, ULONG ulFileOutLen)

{

HRESULT hr = S_OK;

EncoderParameters encoderParameters;

WCHAR szImageFileName[FILE_PATH_LEN + FILE_EXTENSION_LEN + 1];

ULONG parameterValue, i;

Status stat;

ULONG ulNumImagesAllocated;


if (!szFileInPath || !szFileExtension || !ulNumImages || !szFileOutPath)

return E_INVALIDARG;

// An EncoderParameters object has an array of

// EncoderParameter objects. In this case, there is only

// one EncoderParameter object in the array.

encoderParameters.Count = 1;

// Initialize the one EncoderParameter object.

encoderParameters.Parameter[0].Guid = EncoderSaveFlag;

encoderParameters.Parameter[0].Type = EncoderParameterValueTypeLong;

encoderParameters.Parameter[0].NumberOfValues = 1;

encoderParameters.Parameter[0].Value = &parameterValue;

// Get the CLSID of the TIFF encoder.

CLSID encoderClsid;

GetEncoderClsid(L"image/tiff", &encoderClsid);

//Create the desired number of image objects

Image **ppMultiFrame = new Image*[ulNumImages];

if (NULL == ppMultiFrame)

return E_OUTOFMEMORY;

_snwprintf(szFileOutPath, ulFileOutLen-1,

L"%s.tif", szFileInPath);

for (i = 0; i < ulNumImages; i++)

{

_snwprintf(szImageFileName, ARRAY_SIZE(szImageFileName)-1,

L"%s%d.%s", szFileInPath, i, szFileExtension);

ppMultiFrame = new Image(szImageFileName);

if (NULL == ppMultiFrame)

{

hr = E_OUTOFMEMORY;

break;

}

//if this is the first page, create the multi paged file

if (i == 0)

{

// Save the first page (frame).

parameterValue = EncoderValueMultiFrame;

stat = ppMultiFrame->Save(szFileOutPath, &encoderClsid,
&encoderParameters);

if(stat != Ok)

{

hr = E_FAIL;

break;

}

}

else

{

// Save the first page (frame).

parameterValue = EncoderValueFrameDimensionPage;

stat = ppMultiFrame[0]->SaveAdd(ppMultiFrame, &encoderParameters);

}

}

ulNumImagesAllocated = i;


// Close the multiframe file if at least the first image is allocated.

if (ulNumImagesAllocated > 0)

{

parameterValue = EncoderValueFlush;

stat = ppMultiFrame[0]->SaveAdd(&encoderParameters);

if(stat != Ok)

hr = E_FAIL;

}

for (i = 0; i < ulNumImagesAllocated; i++)

{

delete ppMultiFrame;

}

delete ppMultiFrame;

return hr;

}

int CGdiHelper::GetEncoderClsid(const WCHAR* format, CLSID* pClsid)

{

UINT num = 0; // number of image encoders

UINT size = 0; // size of the image encoder array in bytes

ImageCodecInfo* pImageCodecInfo = NULL;

GetImageEncodersSize(&num, &size);

if(size == 0)

return -1; // Failure

pImageCodecInfo = (ImageCodecInfo*)(malloc(size));

if(pImageCodecInfo == NULL)

return -1; // Failure

GetImageEncoders(num, size, pImageCodecInfo);

for(UINT j = 0; j < num; ++j)

{

if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )

{

*pClsid = pImageCodecInfo[j].Clsid;

free(pImageCodecInfo);

return j; // Success

}

}

free(pImageCodecInfo);

return -1; // Failure

}


--
Thank you, Manoj
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no
rights.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.'
Manoj Jain said:
Hi,
I will send the code by Monday - sorry about the delay.

--
Thank you, Manoj
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no
rights.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.'
Hi,

Does anyone know how to use the "printto" verb with ShellExecute() on
files of type .HTML without the Printer dialog coming up? I've tried
multiple variations on specifying the printer to use in the printo
command, but no luck. I can get this to work with a file of type
.TXT, however, I do see Notepad flash open for a second in the
background. How does the Windows Fax Service accomplish this? It is
able to send any document that supports the "printto" verb to the Fax
printer without anything ever showing up--no Printer dialogs, no
applications flashing open, etc. Does anyone know how to accomplish
this programmatically? I have seen many postings on this problem, but
no answers as to how to work around it.

Additionally, Manoj Jain [MSFT] ([email protected]) said he
had sample code for demonstrating how to programmatically print
multiple documents to a single TIF file. Does anyone have this or
know what he was referring to??

Thanks for any help,

Rob
 
Manoj,

I actually have not tried this code yet. The client was willing to
accept faxing only PDF and TXT document file types. Faxing a PDF
document had a behavior such that an instance of Adobe Reader remains
open in the taskbar, but it never steals focus. For TXT file types, I
used a third party product to convert multiple TXT files to a single
TIF file, and then faxed the TIF file.
Therefore, since I was able to satisfy these requirements, I did not
need to go forward with the solution you proposed. However, I thought
this solution that you proposed would only work for image file types,
and not any file type that supports the "printto" verb?

Thanks,

Rob

Manoj Jain said:
Hi,
I did not get the time to complete this. But it should be straightforward
following the method suggested. Have you given that try? If yes, can you
share the code and I can take a look at it and reply.

--
Thank you, Manoj
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no
rights.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.'
Robert Freas said:
Manoj,

Thanks much for the reply!

Did you say you were going to post the code for doing this for any
document type in Windows that supports "printto"? That would be
precisely what I want to do--as opposed to just using this for image
file types.

Thanks much,

Rob

"Manoj Jain [MSFT]" <[email protected]> wrote in message
Here's the code for doing this for all image types like bmps(we tested for
this), jpegs - it has not been made generic, that should be easy to achieve
that for all images. I will try to get the same for all documents and post
it soon enough.

This has been abstracted into a class - CGdiHelper.. The SaveImage takes the
following parameters -
1) szFileInPath - the file path to the in files like c:\temp\image
2) ulNumImagess - number of images to merge.
3) szFileExtension - the extension to work with. Let's assume bmp, then if
ulNumImages is 2, the filenames should be c:\temp\image0.bmp,
c:\temp\image1.bmp, c:\temp\image2.bmp
The rest parameters for out parameters - ie to get the merged tiff file
Sorry about the formatting
#include "stdafx.h"

#include "Scan2FaxDlg.h"

CGdiHelper::CGdiHelper()

{

// Initialize GDI+.

GdiplusStartup(&m_gdiplusToken, &m_gdiplusStartupInput, NULL);

}

CGdiHelper::~CGdiHelper()

{

GdiplusShutdown(m_gdiplusToken);

}

HRESULT CGdiHelper::SaveImage(WCHAR *szFileInPath, WCHAR *szFileExtension,
ULONG ulNumImages, WCHAR *szFileOutPath, ULONG ulFileOutLen)

{

HRESULT hr = S_OK;

EncoderParameters encoderParameters;

WCHAR szImageFileName[FILE_PATH_LEN + FILE_EXTENSION_LEN + 1];

ULONG parameterValue, i;

Status stat;

ULONG ulNumImagesAllocated;


if (!szFileInPath || !szFileExtension || !ulNumImages || !szFileOutPath)

return E_INVALIDARG;

// An EncoderParameters object has an array of

// EncoderParameter objects. In this case, there is only

// one EncoderParameter object in the array.

encoderParameters.Count = 1;

// Initialize the one EncoderParameter object.

encoderParameters.Parameter[0].Guid = EncoderSaveFlag;

encoderParameters.Parameter[0].Type = EncoderParameterValueTypeLong;

encoderParameters.Parameter[0].NumberOfValues = 1;

encoderParameters.Parameter[0].Value = &parameterValue;

// Get the CLSID of the TIFF encoder.

CLSID encoderClsid;

GetEncoderClsid(L"image/tiff", &encoderClsid);

//Create the desired number of image objects

Image **ppMultiFrame = new Image*[ulNumImages];

if (NULL == ppMultiFrame)

return E_OUTOFMEMORY;

_snwprintf(szFileOutPath, ulFileOutLen-1,

L"%s.tif", szFileInPath);

for (i = 0; i < ulNumImages; i++)

{

_snwprintf(szImageFileName, ARRAY_SIZE(szImageFileName)-1,

L"%s%d.%s", szFileInPath, i, szFileExtension);

ppMultiFrame = new Image(szImageFileName);

if (NULL == ppMultiFrame)

{

hr = E_OUTOFMEMORY;

break;

}

//if this is the first page, create the multi paged file

if (i == 0)

{

// Save the first page (frame).

parameterValue = EncoderValueMultiFrame;

stat = ppMultiFrame->Save(szFileOutPath, &encoderClsid,
&encoderParameters);

if(stat != Ok)

{

hr = E_FAIL;

break;

}
}

else

{

// Save the first page (frame).

parameterValue = EncoderValueFrameDimensionPage;

stat = ppMultiFrame[0]->SaveAdd(ppMultiFrame, &encoderParameters);

}
}

ulNumImagesAllocated = i;


// Close the multiframe file if at least the first image is allocated.

if (ulNumImagesAllocated > 0)

{

parameterValue = EncoderValueFlush;

stat = ppMultiFrame[0]->SaveAdd(&encoderParameters);

if(stat != Ok)

hr = E_FAIL;

}

for (i = 0; i < ulNumImagesAllocated; i++)

{

delete ppMultiFrame;

}

delete ppMultiFrame;

return hr;

}

int CGdiHelper::GetEncoderClsid(const WCHAR* format, CLSID* pClsid)

{

UINT num = 0; // number of image encoders

UINT size = 0; // size of the image encoder array in bytes

ImageCodecInfo* pImageCodecInfo = NULL;

GetImageEncodersSize(&num, &size);

if(size == 0)

return -1; // Failure

pImageCodecInfo = (ImageCodecInfo*)(malloc(size));

if(pImageCodecInfo == NULL)

return -1; // Failure

GetImageEncoders(num, size, pImageCodecInfo);

for(UINT j = 0; j < num; ++j)

{

if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )

{

*pClsid = pImageCodecInfo[j].Clsid;

free(pImageCodecInfo);

return j; // Success

}
}

free(pImageCodecInfo);

return -1; // Failure

}


--
Thank you, Manoj
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no
rights.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.'
Hi,
I will send the code by Monday - sorry about the delay.

--
Thank you, Manoj
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no
rights.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.'
Hi,

Does anyone know how to use the "printto" verb with ShellExecute() on
files of type .HTML without the Printer dialog coming up? I've tried
multiple variations on specifying the printer to use in the printo
command, but no luck. I can get this to work with a file of type
.TXT, however, I do see Notepad flash open for a second in the
background. How does the Windows Fax Service accomplish this? It is
able to send any document that supports the "printto" verb to the Fax
printer without anything ever showing up--no Printer dialogs, no
applications flashing open, etc. Does anyone know how to accomplish
this programmatically? I have seen many postings on this problem, but
no answers as to how to work around it.

Additionally, Manoj Jain [MSFT] ([email protected]) said he
had sample code for demonstrating how to programmatically print
multiple documents to a single TIF file. Does anyone have this or
know what he was referring to??

Thanks for any help,

Rob
 
Back
Top