Re: [lazarus] TTrayIcon problem

2008-02-11 Thread Felipe Monteiro de Carvalho
you can also check the example at your local lazarus dir. I think it's
something like

lazarus/examples/trayicon

-- 
Felipe Monteiro de Carvalho

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TTrayIcon problem

2008-02-11 Thread Felipe Monteiro de Carvalho
 FWIW, I use XN Resource Editor to create my main form icon to show in windows
 and that seems to work fine (as does windres for creating the resource) so I
 wonder if its anything to to do with using windres or not ??

Ok, the last difference that I see from here between your project and
the example is the icon file. That shouldn't cause any problem, but
just in case try to use the .ico file from the example on your project
and see if it works.

Also try to compile and run the example project. Those things should
put the problem on a corner.

Anyway, it's just a question of logic, if the example works, how is
your program different?

-- 
Felipe Monteiro de Carvalho

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TTrayIcon problem

2008-02-11 Thread Lee Jenkins

Felipe Monteiro de Carvalho wrote:

On Feb 11, 2008 3:56 PM, Lee Jenkins [EMAIL PROTECTED] wrote:

M:\lazarus\projects\maestrom:\lazarus\IDE\fpc\2.2.0\bin\i386-win32\windres -i M
:\lazarus\projects\maestro\tray.rc -o m:\lazarus\projects\maestro\tray.res
gcc: installation problem, cannot exec `cpp': No such file or directory
m:\lazarus\IDE\fpc\2.2.0\bin\i386-win32\windres: no resources


windres complains it can't find cpp, which means that your path is
wrong, otherwise he would have found it.

before executing the line above fix the path:

PATH=m:\lazarus\IDE\fpc\2.2.0\bin\i386-win32\

The .res file needs to be generate with windres, you can't use another
tool AFAIK.



Thanks Felipe,

I added the lazarus bin folder to my path as you suggested and that allowed me 
to create the .res file.  However, the icon still will not show up in the task 
bar.  I traced through the code and it is getting called (tried both 
TrayIcon.Show and TrayIcon.Visible := true), but is not showing up in task bar.


FWIW, I use XN Resource Editor to create my main form icon to show in windows 
and that seems to work fine (as does windres for creating the resource) so I 
wonder if its anything to to do with using windres or not ??


Thanks again,

--
Warm Regards,

Lee

Everything I needed to learn in life, I learned selling encyclopedias door to 
door.


_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TTrayIcon problem

2008-02-11 Thread Felipe Monteiro de Carvalho
On Feb 11, 2008 3:56 PM, Lee Jenkins [EMAIL PROTECTED] wrote:
 M:\lazarus\projects\maestrom:\lazarus\IDE\fpc\2.2.0\bin\i386-win32\windres 
 -i M
 :\lazarus\projects\maestro\tray.rc -o m:\lazarus\projects\maestro\tray.res
 gcc: installation problem, cannot exec `cpp': No such file or directory
 m:\lazarus\IDE\fpc\2.2.0\bin\i386-win32\windres: no resources

windres complains it can't find cpp, which means that your path is
wrong, otherwise he would have found it.

before executing the line above fix the path:

PATH=m:\lazarus\IDE\fpc\2.2.0\bin\i386-win32\

The .res file needs to be generate with windres, you can't use another
tool AFAIK.

-- 
Felipe Monteiro de Carvalho

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TTrayIcon problem

2008-02-11 Thread Lee Jenkins

Felipe Monteiro de Carvalho wrote:

TIcon isn't fully implemented on Windows so it doesn't give a HICON
handle that TTrayIcon needs.

See bug report: http://bugs.freepascal.org/view.php?id=10305

The wiki page explains how to make TTrayIcon work everywhere:
http://wiki.lazarus.freepascal.org/TrayIcon#Demonstration_program_1

thanks,


I tried this using an icon that was already inside a .rc file for windows.  I 
use this for icon of main form in Windows anyway.  I added an additional icon to 
the resource and followed the instructions on the wiki and still no success 
unfortunately.


  SystrayIcon.Icon.Handle :=
  LoadIcon(HINSTANCE, MAKEINTRESOURCE(101));

  SystrayIcon.Visible := true;

I simply added another icon to the resource and called it 101, but obviously 
that is not the way to go.  Must the icon be in its own resource file or can it 
be placed in the existing resource file I already have?


Also, if its dependent on a handle, can I just load an icon from file and then 
pass the handle of that to the TTrayIcon.Icon.Handle property?  I don't think 
this is the case either since I have tried this too with no success.


--
Warm Regards,

Lee

Everything I needed to learn in life, I learned selling encyclopedias door to 
door.


_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TTrayIcon problem

2008-02-11 Thread Lee Jenkins

Felipe Monteiro de Carvalho wrote:

On Feb 11, 2008 2:43 PM, Lee Jenkins [EMAIL PROTECTED] wrote:

I simply added another icon to the resource and called it 101, but obviously
that is not the way to go.  Must the icon be in its own resource file or can it
be placed in the existing resource file I already have?


I think that being on a separate resource file makes no difference.
Did you rebuild your rc file?


Yes, I rebuilt and opened it up with different editors (VS2005, XNResource) and 
the Icon is there labeled 101 as in the example.


Actually, I had to use XNResource editor to place the icon because the windres 
errors out when I try to use it, not sure what I'm doing wrong with that:


M:\lazarus\projects\maestrom:\lazarus\IDE\fpc\2.2.0\bin\i386-win32\windres -i M
:\lazarus\projects\maestro\tray.rc -o m:\lazarus\projects\maestro\tray.res
gcc: installation problem, cannot exec `cpp': No such file or directory
m:\lazarus\IDE\fpc\2.2.0\bin\i386-win32\windres: no resources

At any rate, the icon is definitely inside the resource file.

I also tried loading an icon and handing the handle to TTrayIcon and that didn't 
seem to work either.


I also tried using the icon suppled with the demo thinking maybe it was 
something with the icon, but that does not work either.  I also tried changing 
the icon ID in the resource from integer to string value just in case, but that 
doesn't work either.


I'm just not sure what I could be doing wrong.

Seems I will have to deploy the sample application in /examples and show that 
when I need to show a try icon ;)



--
Warm Regards,

Lee

Everything I needed to learn in life, I learned selling encyclopedias door to 
door.


_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TTrayIcon problem

2008-02-11 Thread Felipe Monteiro de Carvalho
On Feb 11, 2008 2:43 PM, Lee Jenkins [EMAIL PROTECTED] wrote:
 I simply added another icon to the resource and called it 101, but obviously
 that is not the way to go.  Must the icon be in its own resource file or can 
 it
 be placed in the existing resource file I already have?

I think that being on a separate resource file makes no difference.
Did you rebuild your rc file?

Recent fpc versions can build it directly from the rc file, but I
don't remeber when that was added. I still do it the old way. Make a
script that will call windres to built it:

PATH=path/to/fpc/bin/dir
windres -i myresource.rc -o myresource.res

And then {$R Resource.res}

 Also, if its dependent on a handle, can I just load an icon from file and then
 pass the handle of that to the TTrayIcon.Icon.Handle property?

Sure, just put a HICON handle there. I never did it this way, so I
don't know what function to use. You can read the msdn docs to see
what functions return a HICON:

http://www.google.com/search?hl=ensafe=activeq=site%3Amsdn2.microsoft.com+HICONbtnG=Search

-- 
Felipe Monteiro de Carvalho

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TTrayIcon problem

2008-02-11 Thread Felipe Monteiro de Carvalho
TIcon isn't fully implemented on Windows so it doesn't give a HICON
handle that TTrayIcon needs.

See bug report: http://bugs.freepascal.org/view.php?id=10305

The wiki page explains how to make TTrayIcon work everywhere:
http://wiki.lazarus.freepascal.org/TrayIcon#Demonstration_program_1

thanks,
-- 
Felipe Monteiro de Carvalho

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TTrayIcon problem

2008-02-11 Thread Lee Jenkins

Felipe Monteiro de Carvalho wrote:

TIcon isn't fully implemented on Windows so it doesn't give a HICON
handle that TTrayIcon needs.

See bug report: http://bugs.freepascal.org/view.php?id=10305

The wiki page explains how to make TTrayIcon work everywhere:
http://wiki.lazarus.freepascal.org/TrayIcon#Demonstration_program_1

thanks,


Thanks Felipe,

Wiki was was down last night so I didn't run across the article, just looking at 
the source.




--
Warm Regards,

Lee

Everything I needed to learn in life, I learned selling encyclopedias door to 
door.


_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TTrayIcon problem

2008-02-11 Thread Lee Jenkins

Felipe Monteiro de Carvalho wrote:

On Feb 11, 2008 3:56 PM, Lee Jenkins [EMAIL PROTECTED] wrote:

M:\lazarus\projects\maestrom:\lazarus\IDE\fpc\2.2.0\bin\i386-win32\windres -i M
:\lazarus\projects\maestro\tray.rc -o m:\lazarus\projects\maestro\tray.res
gcc: installation problem, cannot exec `cpp': No such file or directory
m:\lazarus\IDE\fpc\2.2.0\bin\i386-win32\windres: no resources


windres complains it can't find cpp, which means that your path is
wrong, otherwise he would have found it.

before executing the line above fix the path:

PATH=m:\lazarus\IDE\fpc\2.2.0\bin\i386-win32\

The .res file needs to be generate with windres, you can't use another
tool AFAIK.



Ah, well that could be the problem.  I'll try it with that command.

Thanks a bunch,

--
Warm Regards,

Lee

Everything I needed to learn in life, I learned selling encyclopedias door to 
door.


_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives