| 1001 | |
| 1002 | |
| 1003 | void Script::CreateTrayIcon() |
| 1004 | // It is the caller's responsibility to ensure that the previous icon is first freed/destroyed |
| 1005 | // before calling us to install a new one. However, that is probably not needed if the Explorer |
| 1006 | // crashed, since the memory used by the tray icon was probably destroyed along with it. |
| 1007 | { |
| 1008 | ZeroMemory(&mNIC, sizeof(mNIC)); // To be safe. |
| 1009 | // Using NOTIFYICONDATA_V2_SIZE vs. sizeof(NOTIFYICONDATA) improves compatibility with Win9x maybe. |
| 1010 | // MSDN: "Using [NOTIFYICONDATA_V2_SIZE] for cbSize will allow your application to use NOTIFYICONDATA |
| 1011 | // with earlier Shell32.dll versions, although without the version 6.0 enhancements." |
| 1012 | // Update: Using V2 gives an compile error so trying V1. Update: Trying sizeof(NOTIFYICONDATA) |
| 1013 | // for compatibility with VC++ 6.x. This is also what AutoIt3 uses: |
| 1014 | mNIC.cbSize = sizeof(NOTIFYICONDATA); // NOTIFYICONDATA_V1_SIZE |
| 1015 | mNIC.hWnd = g_hWnd; |
| 1016 | mNIC.uID = AHK_NOTIFYICON; // This is also used for the ID, see TRANSLATE_AHK_MSG for details. |
| 1017 | mNIC.uFlags = NIF_MESSAGE | NIF_TIP | NIF_ICON; |
| 1018 | mNIC.uCallbackMessage = AHK_NOTIFYICON; |
| 1019 | mNIC.hIcon = mCustomIconSmall ? mCustomIconSmall : g_IconSmall; |
| 1020 | UPDATE_TIP_FIELD |
| 1021 | if (!Shell_NotifyIcon(NIM_ADD, &mNIC)) |
| 1022 | mNIC.hWnd = NULL; // Set this as an indicator that tray icon is not installed. |
| 1023 | } |
| 1024 | |
| 1025 | |
| 1026 |
nothing calls this directly
no outgoing calls
no test coverage detected