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 ;) 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.