fsTrayIconMgr::fsTrayIconMgr() { m_pIcons = NULL; m_iCurIconIndex = 0; m_cbNIDSize = GetShell32Version () >= 5 ? sizeof (NOTIFYICONDATA) : NOTIFYICONDATA_V1_SIZE; }
BOOL fsTrayIconMgr::ShowBalloon(LPCSTR pszInfo, LPCSTR pszInfoTitle, DWORD dwNiifIcon) { if (GetShell32Version () < 5) return FALSE; NOTIFYICONDATA data; data.cbSize = m_cbNIDSize; data.hWnd = m_hWnd; data.uID = m_nID; data.uFlags = NIF_INFO; if (strlen (pszInfo) > 255) { strncpy (data.szInfo, pszInfo, 255); data.szInfo [255] = 0; } else strcpy (data.szInfo, pszInfo); if (strlen (pszInfoTitle) > 63) { strncpy (data.szInfoTitle, pszInfoTitle, 63); data.szInfoTitle [63] = 0; } else strcpy (data.szInfoTitle, pszInfoTitle); data.dwInfoFlags = dwNiifIcon; data.uTimeout = UINT_MAX; return Shell_NotifyIcon (NIM_MODIFY, &data); }
void CDownloaderProperties_NotificationsPage::OnUseballoon() { if (GetShell32Version () < 5) { MessageBox (LS (L_AVAILON2000), LS (L_ERR), MB_ICONEXCLAMATION); CheckDlgButton (IDC_USEBALLOON, BST_UNCHECKED); return; } SetModified (); UpdateEnabled (); }
VOID Exit_CommandFromTaskbar( const HWND hWnd ) { ShowWindow( hWnd, SW_HIDE ); NOTIFYICONDATA ni; DWORD dwSize = (DWORD) ( GetShell32Version() >= 5 ? sizeof( NOTIFYICONDATA ) : NOTIFYICONDATA_V1_SIZE ); ZeroMemory( &ni, dwSize ); ni.cbSize = sizeof( dwSize ); ni.hWnd = hWnd; Shell_NotifyIcon( NIM_DELETE, &ni ); SendMessage( hWnd, WM_COMMAND, IDM_EXIT_ANYWAY, 0L ); }
BOOL SetTargetPlus( const HWND hWnd, HANDLE * phChildThread, LPHACK_PARAMS lphp ) { TCHAR szIniPath[ MAX_PATH * 2 ]; GetIniPath( szIniPath ); TCHAR szDir[ MAX_PATH + 1 ] = _T( "" ); GetPrivateProfileString( TEXT( "Options" ), TEXT( "WatchDir" ), TEXT( "" ), szDir, MAX_PATH, szIniPath ); if( lstrlen( szDir ) == 0 ) { if( GetShell32Version() < 5 || ! SUCCEEDED( SHGetFolderPath( NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, szDir ) ) ) { GetCurrentDirectory( MAX_PATH + 1, szDir ); } } TCHAR lpszTargetPath[ MAX_PATH * 2 ] = TEXT( "" ); TCHAR lpszTargetExe[ MAX_PATH * 2 ] = TEXT( "" ); OPENFILENAME ofn; ZeroMemory( &ofn, sizeof( OPENFILENAME ) ); ofn.lStructSize = sizeof( OPENFILENAME ); ofn.hwndOwner = hWnd; ofn.lpstrFilter = TEXT( "Application (*.exe)\0*.exe\0All (*.*)\0*.*\0\0" ); ofn.lpstrInitialDir = szDir; ofn.nFilterIndex = 1; ofn.lpstrDefExt = TEXT( "exe" ); ofn.lpstrFile = lpszTargetPath; ofn.nMaxFile = MAX_PATH * 2; ofn.lpstrFileTitle = lpszTargetExe; ofn.nMaxFileTitle = MAX_PATH * 2; #ifdef _UNICODE ofn.Flags = OFN_FILEMUSTEXIST | OFN_READONLY | OFN_ENABLESIZING | OFN_DONTADDTORECENT; #else ofn.Flags = OFN_FILEMUSTEXIST | OFN_READONLY | OFN_ENABLESIZING; #endif ofn.lpstrTitle = TEXT( "Limit & Watch / Watch & Limit" ); if( ! GetOpenFileName( &ofn ) ) { return FALSE; } /* int len = lstrlen( lpszTargetExe ); if( lstrcmpi( &lpszTargetExe[ len - 4 ], TEXT( ".exe" ) ) != 0 ) { MessageBox( hWnd, lpszTargetPath, TEXT( "Not an EXE file!" ), MB_OK | MB_ICONEXCLAMATION ); return FALSE; } */ if( ofn.nFileOffset >= 1 ) { lstrcpy( szDir, lpszTargetPath ); szDir[ ofn.nFileOffset - 1 ] = _T('\0'); WritePrivateProfileString( TEXT( "Options" ), TEXT( "WatchDir" ), szDir, szIniPath ); } DWORD dwTargetProcess = PathToProcess( lpszTargetPath ); if( dwTargetProcess == GetCurrentProcessId() ) { MessageBox( hWnd, TEXT( "BES cannot target itself." ), lpszTargetPath, MB_OK | MB_ICONEXCLAMATION ); return FALSE; } //+ 1.1b11 : We alwasy do this to reset the watched... //- This is needed, to renew the info in reWatching something new //- if( dwTargetProcess == ( DWORD ) -1 ) //- { lphp->lpTarget->dwProcessId = TARGET_PID_NOT_SET; //- } #if !defined( _UNICODE ) lstrcpy( lpszTargetPath, lpszTargetExe ); #endif return SetTargetPlus( hWnd, phChildThread, lphp, lpszTargetPath, lpszTargetExe ); }