Ok guys, in the end I implemented a big time clutch that simulates the behaviour I was after:I created a tiny app in C++ that starts Pharo, the image reads the --serve flag (that I implemented in DefaultCommandLineHandler), hides itself via NB, and kills the UIManager process to prevent refreshes.Then it adds an icon into the tray, with a single context-menu entry (Quit) that kills the Pharo process quits the tiny app itself.I know it's ugly, but it does work and, to the end user, it looks like Pharo just started minimized to tray.Thanks a lot for your help! :)Bernat.2013/11/13 Igor Stasenko <siguctua@gmail.com>On 13 November 2013 12:02, Bernat Romagosa <tibabenfortlapalanca@gmail.com> wrote:
Thanks a lot Torsten!I'll invest the whole morning tomorrow in trying to get a little bit more of this to work.If I don't succeed... there are lots of very good restaurants in Barcelona, Igor ;)i can imagine :) I hope i will be able come there once more one day.
Barcelona is very beautiful city.
:)--2013/11/13 Torsten Bergmann <astares@gmx.de>Hi Bernat,
>how do I translate this into NB code
Either invite Igor (author of NB) for lunch or try this:
Its a C-structure, you convert it by wrapping this in a sublcass
of "NBExternalStructure". See the examples already in a Pharo 3.0 image.
Basically you need:
- define a subclass NBExternalStructure subclass: #WinNotifyIconData ...
- define the correct fields in a class side #fieldsDesc method according to the native data types used in the structure
- call "WinNotifyIconData rebuildFieldAccessors"
- setup the types in a shared pool that you can include later:
- define the pool: SharedPool subclass: #WinTryIconConstants ...
- in a class initialize method you can setup the type
initialize
NOTIFYICONDATA := #WinNotifyIconData.
PNOTIFYICONDATA:= 'NOTIFYICONDATA *'.
- by including the pool you can use "NOTIFYICONDATA" or "PNOTIFYICONDATA" in any native boost call.
If you are in Pharo 3.0 load "OS-Windows" package from the config browser.
Check the subclasses of NBExternalStructure there.
I wrapped many other windows structures already so you can get an idea about
it. For instance have a look at WinConsoleConstants>>initTypeConstants, there you will find
the CONSOLE_CURSOR_INFO, CONSOLE_SCREEN_BUFFER_INFO structs wrapped in WinConsoleCursor, WinConsoleScreenBuffer classes.
Compare them with the MSDN struct description.
>Could the Windows API be any more convoluted and dev-unfriendly in any
>possible sense?
This question should go to M$ not Pharo-user ;)
Bye
T.
BTW: I'm not sure "PNOTIFYICONDATA" alone will solve your problem if I remember correctly
from my Smalltalk/MT and C/C++ times also playing with tray icons.
I guess you need a callback that gets called when the icon is clicked or the tray icon menu
is choosen (see uCallbackMessage member in the struct).
You also need a handle to an icon - either the icon from the EXEs resource section or
by loading one from a bitmap. That means wrapping the icon or bitmap apis too...
Bernat Romagosa.
--
Best regards,
Igor Stasenko.--
Bernat Romagosa.