Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/teraterm/ttpcmn/ttcmn.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6435 by doda, Mon Jul 11 08:53:02 2016 UTC revision 6662 by doda, Mon Apr 3 12:51:37 2017 UTC
# Line 2  Line 2 
2   Copyright(C) 1994-1998 T. Teranishi   Copyright(C) 1994-1998 T. Teranishi
3   All rights reserved. */   All rights reserved. */
4    
5    #ifndef _WIN32_IE
6    #define _WIN32_IE 0x501
7    #endif
8    
9  /* TTCMN.DLL, main */  /* TTCMN.DLL, main */
10  #include "teraterm.h"  #include "teraterm.h"
11  #include "tttypes.h"  #include "tttypes.h"
# Line 2377  int PASCAL CheckComPort(WORD ComPort) Line 2381  int PASCAL CheckComPort(WORD ComPort)
2381          return found;          return found;
2382  }  }
2383    
2384    // Notify Icon 関連
2385    static NOTIFYICONDATA notify_icon = {0};
2386    
2387    void FAR PASCAL CreateNotifyIcon(PComVar cv)
2388    {
2389            if (cv->NotifyIcon == NULL) {
2390                    notify_icon.cbSize = sizeof(notify_icon);
2391                    notify_icon.hWnd = cv->HWin;
2392                    notify_icon.uID = 1;
2393                    notify_icon.uFlags = NIF_ICON | NIF_MESSAGE;
2394                    notify_icon.uCallbackMessage = WM_USER_NOTIFYICON;
2395                    notify_icon.hIcon = (HICON)SendMessage(cv->HWin, WM_GETICON, ICON_SMALL, 0);
2396                    notify_icon.szTip[0] = '\0';
2397                    notify_icon.dwState = 0;
2398                    notify_icon.dwStateMask = 0;
2399                    notify_icon.szInfo[0] = '\0';
2400                    notify_icon.uTimeout = 0;
2401                    notify_icon.szInfoTitle[0] = '\0';
2402                    notify_icon.dwInfoFlags = 0;
2403    
2404                    cv->NotifyIcon = &notify_icon;
2405    
2406                    Shell_NotifyIcon(NIM_ADD, cv->NotifyIcon);
2407            }
2408    
2409            return;
2410    }
2411    
2412    void FAR PASCAL DeleteNotifyIcon(PComVar cv)
2413    {
2414            if (cv->NotifyIcon) {
2415                    Shell_NotifyIcon(NIM_DELETE, cv->NotifyIcon);
2416                    cv->NotifyIcon = NULL;
2417            }
2418    
2419            return;
2420    }
2421    
2422    void FAR PASCAL ShowNotifyIcon(PComVar cv)
2423    {
2424            if (cv->NotifyIcon == NULL) {
2425                    CreateNotifyIcon(cv);
2426            }
2427    
2428            cv->NotifyIcon->uFlags = NIF_STATE;
2429            cv->NotifyIcon->dwState = 0;
2430            cv->NotifyIcon->dwStateMask = NIS_HIDDEN;
2431            Shell_NotifyIcon(NIM_MODIFY, cv->NotifyIcon);
2432            return;
2433    }
2434    
2435    void FAR PASCAL HideNotifyIcon(PComVar cv)
2436    {
2437            if (cv->NotifyIcon) {
2438                    cv->NotifyIcon->uFlags = NIF_STATE;
2439                    cv->NotifyIcon->dwState = NIS_HIDDEN;
2440                    cv->NotifyIcon->dwStateMask = NIS_HIDDEN;
2441                    Shell_NotifyIcon(NIM_MODIFY, cv->NotifyIcon);
2442            }
2443            return;
2444    }
2445    
2446    void FAR PASCAL SetVerNotifyIcon(PComVar cv, unsigned int ver)
2447    {
2448            if (cv->NotifyIcon) {
2449                    cv->NotifyIcon->uVersion = ver;
2450                    Shell_NotifyIcon(NIM_SETVERSION, cv->NotifyIcon);
2451            }
2452            return;
2453    }
2454    
2455    void FAR PASCAL NotifyMessage(PComVar cv, char *msg, char *title)
2456    {
2457            if (msg == NULL) {
2458                    return;
2459            }
2460    
2461            if (cv->NotifyIcon == NULL) {
2462                    CreateNotifyIcon(cv);
2463            }
2464    
2465            cv->NotifyIcon->uFlags = NIF_INFO | NIF_STATE;
2466            cv->NotifyIcon->dwState = 0;
2467            cv->NotifyIcon->dwStateMask = NIS_HIDDEN;
2468    
2469            if (title) {
2470                    cv->NotifyIcon->dwInfoFlags = NIIF_INFO;
2471                    strncpy_s(cv->NotifyIcon->szInfoTitle, sizeof(cv->NotifyIcon->szInfoTitle), title, _TRUNCATE);
2472            }
2473            else {
2474                    cv->NotifyIcon->dwInfoFlags = NIIF_NONE;
2475                    cv->NotifyIcon->szInfoTitle[0] = 0;
2476            }
2477    
2478            strncpy_s(cv->NotifyIcon->szInfo, sizeof(cv->NotifyIcon->szInfo), msg, _TRUNCATE);
2479    
2480            Shell_NotifyIcon(NIM_MODIFY, cv->NotifyIcon);
2481    
2482            return;
2483    }
2484    
2485  BOOL WINAPI DllMain(HANDLE hInstance,  BOOL WINAPI DllMain(HANDLE hInstance,
2486                      ULONG ul_reason_for_call,                      ULONG ul_reason_for_call,
2487                      LPVOID lpReserved)                      LPVOID lpReserved)

Legend:
Removed from v.6435  
changed lines
  Added in v.6662

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26