Try with this (make first a copy of your ToastWindow)
void ToastWindow(IN WCHAR* UseIcon, IN WCHAR* UseCaption, IN WCHAR* UseComment) { //IN HWND hParent, IN HINSTANCE hInstance) {
if (gP.hToast) { DestroyWindow(gP.hToast); }
WCHAR zFont[MAX_PATH]; ClearMemory(zFont, sizeof(zFont));
Path_Combine(zFont, skSkinFolder(), L"trebuc.ttf");
// We compute the correct size
long CommentW = 0, CommentH = 0;
ZD_GetTextBound(UseComment, zFont, 14, CommentW, CommentH, ZD_TextHorzUp, FontStyleRegular); // We use horizontal orientation
long UseW = CommentW + 4;
long UseH = CommentH;
long CaptionW = 0, CaptionH = 0;
ZD_GetTextBound(UseCaption, zFont, 18, CaptionW, CaptionH, ZD_TextHorzUp, FontStyleRegular); // We use horizontal orientation
UseW = max(UseW, CaptionW + 4);
UseH += CaptionH;
long bmW = 0, bmH = 0;
HBITMAP hBitmap = ZI_CreateBitmapFromFile(UseIcon, bmW, bmH);
long xOffset = 0, yOffset = 0;
WCHAR zResource[MAX_PATH]; ClearMemory(zResource, sizeof(zResource));
Path_Combine(zResource, skSkinFolder(), L"robot.png");
if (FileExist(zResource)) {
xOffset = 22, yOffset = 76;
}
UseW = xOffset + 4 + bmW + 4 + UseW + 4;
UseH = yOffset + 4 + max(bmH, UseH) + 4 + 4;
// Here we create the compositing array
// Note: The z-order composition will match the array order, the lower indice at the bottom, the higher on top.
const long nCount = 7;
ZOBJECT arrayobj[nCount]; ClearMemory(&arrayobj[0], sizeof(arrayobj));
if (xOffset) {
long w = 0, h = 0;
ZI_CreateBitmapObject(arrayobj[6], 0, 0, ZI_CreateBitmapFromFile(zResource, w, h), ZD_ARGB(255, 0, 0, 0), ZS_VISIBLE);
}
ZI_CreateBitmapObject(arrayobj[3], xOffset + 4, yOffset + 4, hBitmap, ZD_ARGB(255, 0, 0, 0), ZS_VISIBLE);
ZI_CreateTextObject(arrayobj[4], UseCaption, xOffset + 4 + bmW + 4, yOffset + 4, CaptionW + 8, CaptionH + 8, ZD_ARGB(255, 255, 240, 140), zFont, 18, ZS_VISIBLE, 1, StringAlignmentNear, FontStyleRegular);
ZI_CreateTextObject(arrayobj[5], UseComment, xOffset + 4 + bmW + 4, yOffset + 4 + CaptionH + 4, CommentW + 8, CommentH + 8, ZD_ARGB(255, 255, 213, 83), zFont, 14, ZS_VISIBLE, 1, StringAlignmentNear, FontStyleRegular);
ZI_CreateRectangleObject(arrayobj[2], xOffset + 1, yOffset + 1, UseW - 3 - xOffset, UseH - 3 - yOffset, ZD_ARGB(255, 255, 240, 140), 1, ZS_VISIBLE | ZS_DRAFT, ZD_DRAW_OUTLINE, 0);
ZI_CreateRectangleObject(arrayobj[1], xOffset + 0, yOffset + 0, UseW - xOffset, UseH - yOffset, ZD_ARGB(128, 128, 128, 128), 0, ZS_VISIBLE | ZS_DRAFT, ZD_DRAW_FILLED, 0);
ZI_CreateRectangleObject(arrayobj[0], 0, 0, UseW, UseH, ZD_ARGB(0, 0, 0, 1), 0, ZS_HIDDEN | ZS_DRAFT, ZD_DRAW_FILLED, 0);
WCHAR zFile[MAX_PATH]; ClearMemory(zFile, sizeof(zFile));
Path_Combine(zFile, zGetTempPath(), L"zToast.png");
//Path_Combine(zFile, EXEpath(), L"zToast.png");
ZI_CreateImageComposited(zFile, UseW, UseH, arrayobj, nCount);
RECT rw; GetWindowRect(gP.hGL, &rw);
long x = rw.right - UseW;
long y = rw.bottom - UseH;
// This API requires the use of a file name, rather than a bitmap handle. It can create/use a region on the fly.
HWND hWnd = ZI_CreateWindowFromImage(WS_POPUP, zFile, x, y, gP.hGL, 0, 0, 0);
if (IsWindow(hWnd)) {
ZI_DwmEnable(hWnd);
WCHAR zResource[MAX_PATH]; ClearMemory(zResource, sizeof(zResource));
Path_Combine(zResource, skSkinFolder(), L"T_Close.png");
long w = 0, h = 0;
hBitmap = ZI_CreateBitmapFromFile(zResource, w, h);
x = UseW - w - 8; y = 8 + yOffset;
long nID = ID_TOAST_HIDE;
ZD_DrawBitmapToCtrl(hWnd, x, y, hBitmap, ZD_ColorARGB(255, 0), nID, ZS_VISIBLE);
ZD_SetObjectLocked(nID, TRUE);
//MonitorMessages(hWnd, (LONG_PTR) ToastCallBack);
ZI_EventMessageEx(hWnd, (LONG_PTR)ToastCallBack, WM_LBUTTONUP, TRUE);
gP.hToast = hWnd;
}
zKillFile(zFile);
}