Hi list!
I've never used Pharo on Windows before, but we're starting to package a multi-platform app right now and I've just found out command line arguments don't work like I thought they would. I need to run the image headless, so I figured:
bin-win32\Pharo -headless shared\Pharo2.0.image Would do the trick, but it's not working. Pharo /? doesn't give any hints either, and I can't seem to find the docs for the Windows VM anywhere.
Does anybody know where I can find a Win32 VM reference? Thanks! Bernat Romagosa. |
Ok, I see Pharo -help brings up a window with command line options, but -headless is still firing up the GUI... any ideas? 2013/10/29 Bernat Romagosa <[hidden email]>
Bernat Romagosa. |
try double-dashed option: this is really a mess with VM options handled differently on different OSes.from vm/sqWin32Intel.c : else if (!strcmp(argv[0], "--headless")) { fHeadlessImage = true; return 1; } On 29 October 2013 11:14, Bernat Romagosa <[hidden email]> wrote:
-- Best regards, Igor Stasenko. |
In reply to this post by Bernat Romagosa
AFAIK you can't.
no matter what you do, it stills shows a pharo in the trial. I remember once I hid the fact that I had the app running there by replacing the world with an "administrative morph" (just as other server apps do). It was not terrible cool, but it worked. Esteban On Oct 29, 2013, at 7:14 AM, Bernat Romagosa <[hidden email]> wrote:
|
indeed, --headless does "work" but the image just dies after executing it... :( I guess some FFI research to minimize the app to tray is in place. Thanks!
2013/10/29 Esteban Lorenzano <[hidden email]>
Bernat Romagosa. |
In this direction, I'm trying to call a function in the shell32.dll lib that apparently should let you minimize an app to the system tray, but I'm not having much luck... I guess I don't really understand what am I exactly doing.
So, I tried to translate this into Pharo as:
But it won't let me save the method, reporting it's expecting an argument before PNOTIFYICONDATA. I realize PNOTIFYICONDATA is not a primitive type, but I just don't know how to handle it... :(
|
You can try something like this:
| handle window | handle := NativeBoost forCurrentPlatform squeakWindowHandle. window := NBWin32Window new value: handle; yourself. window hide. or window setWindowText: 'im a main window blablabla'. :) i didn't tested it since its been implemented, but i think it should work. On 30 October 2013 11:20, Bernat Romagosa <[hidden email]> wrote:
-- Best regards, Igor Stasenko. |
Well, this should rather be:
handle :=NativeBoostWin32 squeakWindowHandle. window := NBWin32Window new value: handle; yourself. window hide.
or window setWindowText: 'im a main window blablabla'. Phil On Thu, Oct 31, 2013 at 10:03 PM, Igor Stasenko <[hidden email]> wrote:
|
Hi! Thanks Igor, that kinda worked! Pharo hides, but comes back after half a second or so. I'll keep digging, thanks! :)
2013/11/1 [hidden email] <[hidden email]>
Bernat Romagosa. |
Hi list,
I made some progress but I'm still a bit lost here. I managed to get Pharo to be headless in Win32, by hiding the window via NB as Igor suggested, plus suspending the UI process (UIManager default uiProcess suspend), which was the cause for the window to show up again after a fraction of a second, because of the refresh interval.
However, now I can only close Pharo by killing the process manually, which is not very nice for the end user. So I figured I'd try to add an icon to the system tray with a single context menu entry for closing Pharo.
This is what I'm doing, taken from MSDN:
dwMessage is just a 0 (flag to create a tray icon), but lpdata needs to be a pointer to a struct of this form:
So, my question is: how do I translate this into NB code? How does one define a struct and then pass its pointer to a function in NativeBoost? Thanks a lot for your help, I'm getting closer :)
Bernat. p.s. Could the Windows API be any more convoluted and dev-unfriendly in any possible sense?
2013/11/4 Bernat Romagosa <[hidden email]>
Bernat Romagosa. |
On 13 November 2013 10:25, Bernat Romagosa <[hidden email]> wrote:
This is easy. Just make a subclass of NBExternalStructure, define its fields in #fieldsDesc method (see example subclass). Create it using #new, or #externalNew depending if structure should be non-moving in memory for the rest of its life (but i think its needed only at the moment of call, so #new should work), fill it with proper values, and then pass it to that function. Just make sure that argument type PNOTIFYICONDATA changed to class name of your structure in function signature. Also, note that there is two Shell_NotifyIcon functions under the hood: Shell_NotifyIconA Shell_NotifyIconW the 'A' stands for 'ascii',
and 'W' stands for 'wide', this is how windows manages strings and characters/unicode. For 'A' functions TCHAR == char (1byte) for 'W' functions TCHAR == unsigned short (2bytes)
that means the definition and size of PNOTIFYICONDATA is different
depending on what function you going to be using.
hehe.. this is a typical for everything in windows: many, even basic things require passing and filling various structures with many different fields, and you may find that to initialize fields of one structure, you often need
to create another one and initialize it first :)
-- Best regards, Igor Stasenko. |
Free forum by Nabble | Edit this page |