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

  1. #include "stdafx.h"
  2. #include "utils.h"
  3. VOID Trace(LPCTSTR format,...)
  4. {
  5. #ifdef _DEBUG
  6. TCHAR Buffer[1024];
  7. va_list arglist;
  8. va_start(arglist, format);
  9. wvsprintf(Buffer, format, arglist);
  10. va_end(arglist);
  11. OutputDebugString(Buffer);
  12. OutputDebugString(TEXT("\n"));
  13. #endif
  14. }
  15. HIMAGELIST CreateImageList(INT iImageWidth, INT iImageHeight, INT iMask, INT iNumIcons)
  16. {
  17. HIMAGELIST hImageList = NULL;
  18. //
  19. // TODO: Find out what this mask means
  20. //
  21. iMask = ILC_MASK;
  22. hImageList = ImageList_Create(iImageWidth, iImageHeight, iMask, iNumIcons, 0);
  23. return hImageList;
  24. }
  25. BOOL AddIconToImageList(HINSTANCE hInstance, INT IconResourceID, HIMAGELIST hImageList, INT *pIconIndex)
  26. {
  27. HICON hIcon = NULL;
  28. hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IconResourceID));
  29. if(hIcon == NULL){
  30. Trace(TEXT("LoadIcon failed to load IconResourceID %d"),IconResourceID);
  31. return FALSE;
  32. }
  33. *pIconIndex = ImageList_AddIcon(hImageList, hIcon);
  34. return TRUE;
  35. }