Hey,
I am trying to write simple application that works with Windows Clipboard (capture Clipboard changes (WM_CLIPBOARDUPDATE) and do some actions.
Application uses TTrayIcon component. So, I can hide main window in notification area.
If user press Print Screen button or copy text into Clipboard my application do some actions. One of the features is to show user a message (with some description text, icon etc) when application is hidden in tray. I do not use TTrayIcon Balloon hint (it is not good for me). Instead, I created second form and display it when clipboard change its content.
It works fine, when application main window is visible (on screen). I set some options in form OnShow event and do some animation (to slide from right screen corner) in OnActivate event. It is OK.
When application main window is hidded there is a big problem!
What I do:
Form2.Show; -> OnShow And OnActivate events are fired.
BUT, if I show form2 again (second, third time), only OnShow event is fired - OnActivate event is not working! WHY?
I hide mainform to Tray:
Application.ShowMainForm := False;
MainFrm.Hide;
ShowWindow(Application.Handle, SW_HIDE);
And I show it using:
MainFrm.Show;
Application.ShowMainForm := True;
ShowWindow(Application.Handle, SW_SHOW);
Application.BringToFront();
-Pawel