| 2801 |
return found; |
return found; |
| 2802 |
} |
} |
| 2803 |
|
|
|
// Notify Icon 関連 |
|
|
static NOTIFYICONDATA notify_icon = {0}; |
|
|
static int NotifyIconShowCount = 0; |
|
|
static HICON CustomIcon = NULL; |
|
|
|
|
|
void WINAPI SetCustomNotifyIcon(HICON icon) |
|
|
{ |
|
|
CustomIcon = icon; |
|
|
} |
|
|
|
|
|
HICON WINAPI GetCustomNotifyIcon(void) |
|
|
{ |
|
|
return CustomIcon; |
|
|
} |
|
|
|
|
|
void WINAPI CreateNotifyIcon(PComVar cv) |
|
|
{ |
|
|
if (cv->NotifyIcon == NULL) { |
|
|
notify_icon.cbSize = sizeof(notify_icon); |
|
|
notify_icon.hWnd = cv->HWin; |
|
|
notify_icon.uID = 1; |
|
|
notify_icon.uFlags = NIF_ICON | NIF_MESSAGE; |
|
|
notify_icon.uCallbackMessage = WM_USER_NOTIFYICON; |
|
|
if (CustomIcon) { |
|
|
notify_icon.hIcon = CustomIcon; |
|
|
} |
|
|
else { |
|
|
notify_icon.hIcon = (HICON)SendMessage(cv->HWin, WM_GETICON, ICON_SMALL, 0); |
|
|
} |
|
|
notify_icon.szTip[0] = '\0'; |
|
|
notify_icon.dwState = 0; |
|
|
notify_icon.dwStateMask = 0; |
|
|
notify_icon.szInfo[0] = '\0'; |
|
|
notify_icon.uTimeout = 0; |
|
|
notify_icon.szInfoTitle[0] = '\0'; |
|
|
notify_icon.dwInfoFlags = 0; |
|
|
|
|
|
cv->NotifyIcon = ¬ify_icon; |
|
|
|
|
|
Shell_NotifyIcon(NIM_ADD, cv->NotifyIcon); |
|
|
|
|
|
NotifyIconShowCount = 0; |
|
|
} |
|
|
|
|
|
return; |
|
|
} |
|
|
|
|
|
void WINAPI DeleteNotifyIcon(PComVar cv) |
|
|
{ |
|
|
if (cv->NotifyIcon) { |
|
|
Shell_NotifyIcon(NIM_DELETE, cv->NotifyIcon); |
|
|
cv->NotifyIcon = NULL; |
|
|
NotifyIconShowCount = 0; |
|
|
} |
|
|
|
|
|
return; |
|
|
} |
|
|
|
|
|
void WINAPI ShowNotifyIcon(PComVar cv) |
|
|
{ |
|
|
if (cv->NotifyIcon == NULL) { |
|
|
CreateNotifyIcon(cv); |
|
|
} |
|
|
|
|
|
cv->NotifyIcon->uFlags = NIF_STATE; |
|
|
cv->NotifyIcon->dwState = 0; |
|
|
cv->NotifyIcon->dwStateMask = NIS_HIDDEN; |
|
|
Shell_NotifyIcon(NIM_MODIFY, cv->NotifyIcon); |
|
|
NotifyIconShowCount += 1; |
|
|
|
|
|
return; |
|
|
} |
|
|
|
|
|
void WINAPI HideNotifyIcon(PComVar cv) |
|
|
{ |
|
|
if (NotifyIconShowCount > 1) { |
|
|
NotifyIconShowCount -= 1; |
|
|
} |
|
|
else { |
|
|
if (cv->NotifyIcon) { |
|
|
cv->NotifyIcon->uFlags = NIF_STATE; |
|
|
cv->NotifyIcon->dwState = NIS_HIDDEN; |
|
|
cv->NotifyIcon->dwStateMask = NIS_HIDDEN; |
|
|
Shell_NotifyIcon(NIM_MODIFY, cv->NotifyIcon); |
|
|
} |
|
|
NotifyIconShowCount = 0; |
|
|
} |
|
|
|
|
|
return; |
|
|
} |
|
|
|
|
|
void WINAPI SetVerNotifyIcon(PComVar cv, unsigned int ver) |
|
|
{ |
|
|
if (cv->NotifyIcon) { |
|
|
cv->NotifyIcon->uVersion = ver; |
|
|
Shell_NotifyIcon(NIM_SETVERSION, cv->NotifyIcon); |
|
|
} |
|
|
return; |
|
|
} |
|
|
|
|
|
void WINAPI NotifyMessage(PComVar cv, char *msg, char *title, DWORD flag) |
|
|
{ |
|
|
if (msg == NULL) { |
|
|
return; |
|
|
} |
|
|
|
|
|
if (! HasBalloonTipSupport()) { |
|
|
return; |
|
|
} |
|
|
|
|
|
if (cv->NotifyIcon == NULL) { |
|
|
CreateNotifyIcon(cv); |
|
|
} |
|
|
|
|
|
cv->NotifyIcon->uFlags = NIF_INFO | NIF_STATE; |
|
|
cv->NotifyIcon->dwState = 0; |
|
|
cv->NotifyIcon->dwStateMask = NIS_HIDDEN; |
|
|
|
|
|
if (title) { |
|
|
cv->NotifyIcon->dwInfoFlags = flag; |
|
|
strncpy_s(cv->NotifyIcon->szInfoTitle, sizeof(cv->NotifyIcon->szInfoTitle), title, _TRUNCATE); |
|
|
} |
|
|
else { |
|
|
cv->NotifyIcon->dwInfoFlags = NIIF_NONE; |
|
|
cv->NotifyIcon->szInfoTitle[0] = 0; |
|
|
} |
|
|
|
|
|
strncpy_s(cv->NotifyIcon->szInfo, sizeof(cv->NotifyIcon->szInfo), msg, _TRUNCATE); |
|
|
|
|
|
Shell_NotifyIcon(NIM_MODIFY, cv->NotifyIcon); |
|
|
|
|
|
NotifyIconShowCount += 1; |
|
|
|
|
|
return; |
|
|
} |
|
|
|
|
| 2804 |
/* |
/* |
| 2805 |
* @return エラーが有る場合 FALSE |
* @return エラーが有る場合 FALSE |
| 2806 |
* @param[in] BOOL first_instance |
* @param[in] BOOL first_instance |