Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
1.0 KiB

#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;
}