//--------------------------------------------------------------------------- void __fastcall ::TTrayIcon::PopupBalloon(UnicodeString Title, const UnicodeString & Str, TQueryType QueryType, unsigned int Timeout, TNotifyEvent OnBalloonClick, TObject * BalloonUserData) { if (Timeout > 30000) { // this is probably system limit, do not try more, especially for // the timeout-driven hiding of the tray icon (for Win2k) Timeout = 30000; } FTrayIcon->uFlags |= NIF_INFO; Title = FORMAT(L"%s - %s", (Title, AppNameString())); StrPLCopy(FTrayIcon->szInfoTitle, Title, LENOF(FTrayIcon->szInfoTitle) - 1); UnicodeString Info = Str; // When szInfo is empty, balloon is not shown // (or actually it means the balloon should be deleted, if any) if (Info.IsEmpty()) { Info = L" "; } StrPLCopy(FTrayIcon->szInfo, Info, LENOF(FTrayIcon->szInfo) - 1); FTrayIcon->uTimeout = Timeout; switch (QueryType) { case qtError: FTrayIcon->dwInfoFlags = NIIF_ERROR; break; case qtInformation: case qtConfirmation: FTrayIcon->dwInfoFlags = NIIF_INFO; break; case qtWarning: default: FTrayIcon->dwInfoFlags = NIIF_WARNING; break; } KillTimer(FTrayIcon->hWnd, 1); if (Visible) { Update(); } else { Notify(NIM_ADD); } FOnBalloonClick = OnBalloonClick; delete FBalloonUserData; FBalloonUserData = BalloonUserData; // Clearing the flag ensures that subsequent updates does not hide the baloon // unless CancelBalloon is called explicitly FTrayIcon->uFlags = FTrayIcon->uFlags & ~NIF_INFO; }
//--------------------------------------------------------------------------- void __fastcall PuttyInitialize() { SaveRandomSeed = true; InitializeCriticalSection(&putty_section); // make sure random generator is initialised, so random_save_seed() // in destructor can proceed random_ref(); flags = FLAG_VERBOSE | FLAG_SYNCAGENT; // verbose log sk_init(); AnsiString VersionString = SshVersionString(); assert(!VersionString.IsEmpty() && (static_cast<size_t>(VersionString.Length()) < LENOF(sshver))); strcpy(sshver, VersionString.c_str()); AnsiString AppName = AppNameString(); assert(!AppName.IsEmpty() && (static_cast<size_t>(AppName.Length()) < LENOF(appname_))); strcpy(appname_, AppName.c_str()); }