windows-nt/Source/XPSP1/NT/printscan/wia/test/propview/utils.cpp

46 lines
1 KiB
C++
Raw Permalink Normal View History

2020-09-26 03:20:57 -05:00
#include "stdafx.h"
#include "utils.h"
VOID Trace(LPCTSTR format,...)
{
#ifdef _DEBUG
TCHAR Buffer[1024];
va_list arglist;
va_start(arglist, format);
wvsprintf(Buffer, format, arglist);
va_end(arglist);
OutputDebugString(Buffer);
OutputDebugString(TEXT("\n"));
#endif
}
HIMAGELIST CreateImageList(INT iImageWidth, INT iImageHeight, INT iMask, INT iNumIcons)
{
HIMAGELIST hImageList = NULL;
//
// TODO: Find out what this mask means
//
iMask = ILC_MASK;
hImageList = ImageList_Create(iImageWidth, iImageHeight, iMask, iNumIcons, 0);
return hImageList;
}
BOOL AddIconToImageList(HINSTANCE hInstance, INT IconResourceID, HIMAGELIST hImageList, INT *pIconIndex)
{
HICON hIcon = NULL;
hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IconResourceID));
if(hIcon == NULL){
Trace(TEXT("LoadIcon failed to load IconResourceID %d"),IconResourceID);
return FALSE;
}
*pIconIndex = ImageList_AddIcon(hImageList, hIcon);
return TRUE;
}