euphoria
Emutalk Member
The way i do it is wrong - if i move a window in front of my prog it draws the icon on top of the moved window and leaves a 'tail'.
This is what i use to draw the icon
And here i call it (ccPaint() gets called after a WM_PAINT msg):
What is the correct way to update the icon?
PS. the indent tag sucks...
This is what i use to draw the icon
Code:
void draw_icon(HICON hIcon) {
[INDENT]RECT rect;
if (GetWindowRect(GetDlgItem(hWndMainDlg, IDC_MAIN_STARS), &rect) == 0) {[INDENT]MessageBox(hWndMainDlg, "GetClientRect() failed!", "***Error", 0);[/INDENT]
} else {
[INDENT]HDC hDC;[/INDENT]
if ((hDC = CreateDC("DISPLAY", NULL, NULL, NULL)) == NULL) {
[INDENT]MessageBox(hWndMainDlg, "CreateDC(\"DISPLAY\", NULL, NULL, NULL) failed!", "***Error", 0);
return;[/INDENT]
}
if (DrawIconEx(hDC, rect.right+2, rect.top+2, hIcon, 0, 0, 0, NULL, DI_NORMAL) == 0) {
[INDENT]MessageBox(hWndMainDlg, "DrawIconEx() failed!", "***Error", 0);[/INDENT]
}
DeleteDC(hDC);
}[/INDENT]
}
And here i call it (ccPaint() gets called after a WM_PAINT msg):
Code:
void ccPaint(HWND hWnd, HDC hdc)
{
[INDENT]PAINTSTRUCT ps;
hdc = BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
if (hIcon != NULL) {
[INDENT]draw_icon(hIcon);[/INDENT]
}[/INDENT]
}
What is the correct way to update the icon?
PS. the indent tag sucks...