 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
qyte Guest
|
Posted: Thu Jun 09, 2005 1:13 pm Post subject: using TTrayIcon... |
|
|
Is it possible using windows sdk in conjunction with the
TTrayIcon provided with CBuilder 6 to show a balloon help???
|
|
| Back to top |
|
 |
Danila Vershinin Guest
|
Posted: Thu Jun 09, 2005 3:37 pm Post subject: Re: using TTrayIcon... |
|
|
"qyte" <gyte (AT) vivodinet (DOT) gr> wrote
| Quote: | Is it possible using windows sdk in conjunction with the TTrayIcon
provided with CBuilder 6 to show a balloon help???
|
No, it's not.
Either you have to write all the code to create your tray icon and then
create balloon tooltips, or you could use a third party tray icon component,
that supports balloon tooltips. But you could try the following code
(untested)
###########################################################
NOTIFYICONDATA IconData;
IconData.cbSize = sizeof( NOTIFYICONDATA );
IconData.uID = (UINT) TrayIcon1; // <---- this identifies which icon
to operate with
IconData.hWnd = TrayIcon1->GetHandle(); // <---- handle to nonvisual
window of TTrayIcon, it also identifies the tray icon
IconData.uFlags = NIF_INFO;
IconData.dwInfoFlags = NIIF_INFO;
IconData.uTimeout = 15000;
StrLCopy( IconData.szInfo, InfoText.c_str(), 255 );
StrLCopy( IconData.szInfoTitle, InfoTitle.c_str(), 63 );
Shell_NotifyIcon( NIM_MODIFY, &IconData );
###########################################################
So yes, it is possible (this should work), lol
Besides not supporting balloon tooltips, TTrayIcon from Borland doesn't
survive Explorer crashes. Run your program, kill the explorer.exe, and after
it restarts your icon will be gone. :)
Check http://cia.pnz.ru/traypack/
I am currently in work on the component. And it does support balloon
tooltips and it does survive explorer's crashes. Though the component is
currently not available for download, you can wait few days and it will be
ready. Now you can check executable demo
http://cia.pnz.ru/traypack/trayicon/traybeta.zip
Cheers
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Fri Jun 10, 2005 9:38 am Post subject: Re: using TTrayIcon... |
|
|
qyte <gyte (AT) vivodinet (DOT) gr> wrote:
| Quote: | Is it possible using windows sdk in conjunction with the
TTrayIcon provided with CBuilder 6 to show a balloon help???
|
No and do not use that component. It's very buggy.
I posted an animated tray icon a while ago and I simply
haven't had time to add the restore and balloon tips:
http://tinyurl.com/dgao5
Read the entire thread because the was a change and the last
entry tells you how to contact a guy that wrapped it into a
component. Perhaps the 2 of you can work together to add the
restart and balloon tips. Then that would be the most complete
TrayIcon possible.
When explorer crashes and is restarted, it recreates the
taskbar (and system tray) so the Icon is lost so you need to
replace it. When this happens, Windows broadcasts a
message to all windows and it's called "TaskbarCreated".
The trick is that the numeric ID for this message is not
constant. That is, it changes every time Windows starts so the
numeric value must be obtained at runtime by using the win32
API RegisterWindowMessage:
UINT uTaskbarCreate = ::RegisterWindowMessage( "TaskbarCreated" );
Then just listen for the message uTaskbarCreate in the
TAnimatedTrayIcon::AppHook function to know when to re-add
the icon.
For the balloon tips, have a look here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/tooltip/usingtooltips.asp
or
http://tinyurl.com/4ckox
At first glance, it looks like all you need to do is add a
couple lines of code to my TAnimated class. If you do add this
stuff, come back and post it for every one else to use (that
the price for using my code).
~ JD
|
|
| Back to top |
|
 |
Danila Vershinin Guest
|
Posted: Fri Jun 10, 2005 1:32 pm Post subject: Re: using TTrayIcon... |
|
|
"JD" <nospam (AT) nospam (DOT) com> wrote
| Quote: | When explorer crashes and is restarted, it recreates the taskbar....
|
It HAS been implemented already, check the demo
http://cia.pnz.ru/traypack/trayicon/traybeta.zip
|
|
| Back to top |
|
 |
Danila Vershinin Guest
|
Posted: Fri Jun 10, 2005 1:41 pm Post subject: Re: using TTrayIcon... |
|
|
"JD" <nospam (AT) nospam (DOT) com> wrote
| Quote: | No and do not use that component. It's very buggy.
|
As I said in my other post, yes, it is possible
And no, it is not buggy.
Just because you don't know what .uID it assigns to the NOTIFYICONDATA
structure, it doesn't mean that it is buggy.
Cheers
|
|
| Back to top |
|
 |
JD Guest
|
|
| Back to top |
|
 |
Danila Vershinin Guest
|
Posted: Sat Jun 11, 2005 4:07 pm Post subject: Re: using TTrayIcon... |
|
|
"JD" <nospam (AT) nospam (DOT) com> wrote
| Quote: | Then by all means, go right ahead and use it.
I surely will. |
| Quote: | Please inform Gambit that he's mistaken.
Why not let him thinking that he was right?  |
The only use of the link you've put in your last post was reading this post
by Mauro:
<quote>
[...] but the sample TrayIcon works perfectly. Simply there
are not clear istructions about, and are needed some tests before
understanding well how it works. Thats all.
</quote>
The key phrase is "understanding well how it works" :)
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Sat Jun 11, 2005 8:55 pm Post subject: Re: using TTrayIcon... |
|
|
"Danila Vershinin" <danprep (AT) yahoo (DOT) com> wrote:
| Quote: |
Please inform Gambit that he's mistaken.
Why not let him thinking that he was right?
|
Because Gambit is always (irritatingly) right.
| Quote: | The only use of the link
|
I'm surprised that it was truncated. There's a first time for
everything I guess.
| Quote: | you've put in your last post was reading this post by Mauro:
[...]
The key phrase is "understanding well how it works"
|
To be more precise, the key word is "understanding". That
would include how it works and *does not* work:
http://tinyurl.com/bt3qv
http://tinyurl.com/8s8vp
http://tinyurl.com/8kw8x
http://tinyurl.com/d5hxy
http://tinyurl.com/bbb2y
http://tinyurl.com/cpoof
http://tinyurl.com/b6pk6
http://tinyurl.com/dj6bj
http://tinyurl.com/7v5wp
http://tinyurl.com/7j39u
http://tinyurl.com/axb78
and those are just a few.
The simple truth is that TTrayIcon works in a simple
application but it does not play well with others. From
what I've been able to determine, it's hooking methods
are very impolite which leads to all sorts of problems.
If it's not free and it doesn't come with source, it's not
even worth looking at - especially when 99% of the source is
here for free and the source supports animation and sound
which yours does not.
~ JD
|
|
| Back to top |
|
 |
Danila Vershinin Guest
|
Posted: Sun Jun 12, 2005 8:41 am Post subject: Re: using TTrayIcon... |
|
|
"JD" <nospam (AT) nospam (DOT) com> wrote
| Quote: | Because Gambit is always (irritatingly) right.
|
I don't think that should irritate you or anyone else :)
I am not gonna look through all the links you've given, but looking through
first four (!!!) does give the impression (and I believe a true one) that I
am right. It is not buggy. And the only thing that made it buggy is gossip.
All the posts in first four links mentioned and problems that people had
with it are easily exaplained *NOT in the context of TTrayIcon being BUGGY*.
With that said, I will give you one example. and I guess I will give you few
more, but this NG is not for discussing who was right and who wasn't , and
besides I am currently having another examination set, wish me luck, lol.
(be back on Tuesday)
Example1
###################################################################
<quote>
How to use TTrayIcon shipped with BCB6?
I did following:
1. Assigned TImageList object (with single icon) to TTrayIcon::Icons
2. Assigned a handler to Application::OnMinimize
3. Above handler contains only "TrayIcon->Minimize();"
And after minimizing my app disappears from task bar and
applications tab of Task Manager. It exists only in Processes
tab of TM.
</quote>
Well, sure. The person who wrote that (sorry, I didn't copy his/her name)
never knew that TTrayIcon already handles minimizing when needed. It does
already minimize your application on Application:Minimize by handling
WM_SYSCOMMAND: message in the Application hook.
Take a look:
bool __fastcall TTrayIcon::ApplicationHookProc(TMessage &Message)
{
switch(Message.Msg)
{
case WM_SYSCOMMAND:
{
if (Message.WParam == SC_MINIMIZE)
Minimize();
if (Message.WParam == SC_RESTORE)
Restore();
} break; ....[...]
So doing TrayIcon->Minimize() in the Application:OnMinimize is a big bad bug
in the code. :)
And let's take a look what Gambit wrote on the above post.
<quote>
| Quote: | How to use TTrayIcon shipped with BCB6?
I do not recommend it. TTrayIcon is notoriously buggy. |
</quote>
Ok, now looking through other threads...
<quote>
Hi,
I am using the TTrayIcon sample that comes with Builder 6 but I am
having a little problem with the restore command and modal forms
</quote>
And then Vladimir Stefanovic came with his eternal *I've heard in this NG*,
look
<quote>
Hi,
I never worked with TTrayIcon because I'v heard in this NG
that it's bugy & purely designed. So I suggest you to start with
something that is proven to work. ...[...]
</quote>
here are the quotes from another thread
<quote> The TTrayIcon component is well known as being buggy. </quote>
<quote>
| Quote: | Look for TCoolTrayIcon. Works well here no problems and comes with full
source. </quote
quote |
Just tried it, and no joy Locks up just the same way as TTrayIcon.
I am staring to suspect that there is some other component
screwing around with the tray or the Explorer in some way. Must
check my changelog and sse if I can spot it.
<quote>Well, after a vigorous session of disabeling all major portions
of the code, and then re-enabeling them bit by bit, I have traced
the problem to code in an associated mouse hook in a seperate
DLL </quote>
So in conclusion there is only one thing left to say. That wasn't really
nice to a Borland guy(s) who have programmed the TTrayIcon. And once again,
I sincerely believe that TTrayIcon has become *buggy* only by the matter of
people gossip. I surely will put few more EXAMPLES in, if you wish, but
that's gonna be on Tuesday.
Cheers
|
|
| Back to top |
|
 |
Danila Vershinin Guest
|
Posted: Sun Jun 12, 2005 11:56 am Post subject: Re: using TTrayIcon... |
|
|
"JD" <nospam (AT) nospam (DOT) com> wrote
| Quote: | I'm surprised that it was truncated. There's a first time for everything I
guess.
|
I've just read the rest of the threads. There was nothing to truncate.
Also, some of the threads do not refer to TTrayIcon's *bugs* question at
all, so next time, be more attentive before giving another links *set*.
| Quote: | The simple truth is that TTrayIcon works in a simple application but it
does not play well with others.
|
The simple truth is that the more complex application becomes, the more bugs
people have in it. And that does NOT mean that you have to blaim it all on
the way the component was written/designed and refer other people to use
smth different to manage tray icons in applications.
All these *bugs* apply to this standard template: <OMG, I use TTrayIcon from
the "Samples" tab and there is smth wrong with it/> - <Yep, I've heard it is
buggy, don't ever use it/>
And in most of the cases, you don't ask for the source code when a person
has problems with TTrayIcon, generally the answer is <it is buggy, forget
about it>.
Even if you think there is a bug, you could ask for the application's source
to see what the problem is, or if there actually IS a problem with it, we
all have TTrayIcon source code and we can see what's wrong or not. But you
never do(ask), mostly apply the standard phrase above and put the standard
link, done.
< From what I've been able to determine, it's hooking methods are very
impolite which leads to all sorts of problems.
There is nothing wrong with TTrayIcon's hooking methods. Figure it.
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Sun Jun 12, 2005 12:52 pm Post subject: Re: using TTrayIcon... |
|
|
"Danila Vershinin" <danprep (AT) yahoo (DOT) com> wrote:
| Quote: |
[...] And that does NOT mean that you have to blaim it all
on the way the component was written/designed [...]
|
It's poorly designed - period. For example, the example that
you pointed out with Application::OnMinimize causing an AV.
You could do that with the code that I posted and it won't
throw. A good analogy of what you're saying would be going to
the Doctor and saying 'It hurts when I do this.' and instead
of splinting the broken limb, the Doctor says 'Then don't do
that!'.
| Quote: | [...] And in most of the cases, you don't ask for the source
code when a person has problems with TTrayIcon,
|
That's because it's been causing problems for several years
and it's to the point of beating a dead horse.
| Quote: | Even if you think there is a bug, you could ask for the
application's source to see what the problem is,
|
The best advice that any one can give is *not* to fix existing
code but to point them away from TTrayIcon.
| Quote: | There is nothing wrong with TTrayIcon's hooking methods.
|
LOL. Consider the Application::OnMinimize example again.
Exaclty what do you think was causing the AV?
I have no clue what you intended to comunicate with this but if
you want to get into a pissing contest little girl, take it to
off-topic or non-technical and beat your chest there.
~ JD
|
|
| Back to top |
|
 |
Danila Vershinin Guest
|
Posted: Sun Jun 12, 2005 1:18 pm Post subject: Re: using TTrayIcon... |
|
|
"JD" <nospam (AT) nospam (DOT) com> wrote
| Quote: | LOL. Consider the Application::OnMinimize example again.
Exaclty what do you think was causing the AV?
|
Definately not the TTrayIcon 's hooking methods. It was a bug in the guy's
code.
| Quote: | [..] beat your chest there.
That wasn't my intention, really. |
Right now I do not have time to discuss this issue further more and I see
that you and I agree that we shouldn't any longer.
qyte <gyte (AT) vivodinet (DOT) gr> wrote:
| Quote: | Is it possible using windows sdk in conjunction with the
TTrayIcon provided with CBuilder 6 to show a balloon help???
No and do not use that component. It's very buggy.
|
In conclusion of my posts in this thread I will answer to qyte, once again
Yes, it is possible. Look at the source code that I've put in this thread.
It works.
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Wed Jun 15, 2005 10:22 am Post subject: Re: using TTrayIcon... |
|
|
"Danila Vershinin" <danprep (AT) yahoo (DOT) com> wrote:
| Quote: |
[...] Look at the source code that I've put in this thread.
It works.
IconData.cbSize = sizeof( NOTIFYICONDATA );
|
This is unreliable. The cbSize member needs to be set
according to the current version of the shell32.dll
which, if less than 5.0 the cbSize member needs to be
set to NOTIFYICONDATA_V1_SIZE.
| Quote: | IconData.uID = (UINT) TrayIcon1; // <---- this identifies which icon to operate with
|
This defeats the purpose of this member which is to allow for
multiple icons to be associated with the same HWND. The only
reason this works is because the uID member is programmer
defined and you cast the object to an UINT to meet the type
requirements.
As for TTrayIcon being unreliable, it took me about 10 minutes
to find a fatal bug with it. If the underlying form's HWND is
recreated, the HWND associated with the TTaryIcon is no longer
valid. On XP, the OS detects this and removes it from the tray.
I'm not inclined to to test the behavior on other versions of
Windows because it doesn't matter if it stays in the tray or
not.
What this means is that one *could* have an application loaded
and have no means to interact with it because it's not Visible
and has no Icon on the taskbar. Even worse would be if that
application was designed to have only a single instance
permitted. The only solution (for most users) would be to
restart the system.
As for your demo, OnBalloonHide does nothing but that's no
surprise because that message is never sent under any
condition.
When I restarted explorer, the application was restored to the
tray but the icon was missing and the other events didn't work
any more.
You're using IconMask which is reserved. This means that while
it may work now (but doesn't perform anything useful) it most
surely will break in future releases of shell32.dll.
~ JD
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Wed Jun 15, 2005 10:28 am Post subject: Re: using TTrayIcon... |
|
|
"Danila Vershinin" <danprep (AT) yahoo (DOT) com> wrote:
| Quote: |
[...] Though the component is currently not available for
download, you can wait few days and it will be ready.
|
You've been saying that since at least last March. Once
completed, then how long will it take to get bug fixes?
~ JD
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|