IRC Log Viewer » #firebreath » 2013-09-18

IRC Nick Time (GMT-7) Message
cfrost 06:09 Hi. Does anyone know if its possible to evaluate JS from the plugins and use its return value? Like calling NPN_Evaluate(instance, &window, &str, &result) or similar. In firebreath (and other source where it has been called) the result is never used. Why is this?
taxilian 10:09 if cfrost ever comes back, someone explain to him that the reason that evaluateJavascript has no return value is because it is cross-browser and on IE there is no return value
but he could call window.eval
SinnerSmile 13:09 Hello gentlemen
taxilian 13:09 'morning
SinnerSmile 13:09 i've got a question, how can i create win32 window through FB, actually i need some function that will create win32 window, and in that I can pass some values from JS to create window with that values. It seems that i somehow need to implement WinMain kind of function in entry point of plugin... confused with that. Or maybe is it possible to do this via dll that I will link to FB plugin project?
taxilian 13:09 There is no reason that you'd need to implement any special function
that I know of
you just create the window… maybe I don't understand your question?
a WinMain would only be in a windows application, and this is not a windows application, so there is no reason you would need one
basically you just need to register your window class somewhere; since you only need to do it once per process I'd probably put it in your StaticInitialize function
and destroy it in StaticDeinitialize
and then you just create it wherever you need to; if you want the parent window to be the plugin's HWND then you'll need to wait for AttachedEvent and make sure you destroy it before the end of DetachedEvent
otherwise it should be about the same as you'd normally expect
SinnerSmile 13:09 ok, first i need to register class and create a window e.t.c, for that i need some handles as hInst and int nShowCmd, in win32 application i got them in WinMain, how can i get it in FB, it seems that I don't understand something simple again.
taxilian 13:09 int nShowCmd ?
SinnerSmile 13:09 int CALLBACK WinMain( _In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow );
taxilian 13:09 I haven't a clue what nCmdShow is
but your instance you can get from the global variable defined in PluginAuto/Win/dllmain.cpp
SinnerSmile 13:09 nCmdShow to ShowWindow
taxilian 13:09 extern HINSTANCE gInstance;
for an example of creating a class, see src/PluginCore/Win/WinMessageWindow.cpp
whatever nCmdShow is you won't get it in a plugin
I haven't a clue what it is
SinnerSmile 13:09 Controls how the window is to be shown. msdn says, it need to be provided for ShowWindow function http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548(v=vs.85).aspx
taxilian 13:09 and good news! that same page tells you which values you can use
pick one
SinnerSmile 13:09 ah yes true, can just pick a value, and i need to exter HINSTANCE gInstance to get hInst?
taxilian 13:09 yes
note that external (to the browser) windows are not encouraged in plugins
and I'm not certain they are possible on mac
SinnerSmile 13:09 well it seems to be not so complicated, hope example will clear it for me, will look at it now
pardon but what do you mean by "not encouraged in plugins"?
taxilian 13:09 I mean that browser manufacturers consider it a Bad Idea and would prefer you didn't do it
so they won't make it easy and they make arbitrariliy do things that make it harder
but I don't know that they can actually stop you
SinnerSmile 13:09 wow, it's a really important question, but then i can just make dll, that will create window and link it to FB project, and as my dll going to be kind of not part of plugin they theoreticly can't stop me from this?
taxilian 13:09 it makes no difference what creates the window
you dont' own the process
I'm not saying you can't do it, just that you need to be aware that it's considered bad practice, so if you don't really need to you shouldn't
SinnerSmile 13:09 I understand, just trying to find options that will be less dependent on browser developer's wish to make my life harder)
Well, can i somehow create window in process owned by me and in the same time be able to communicate it with JS via FB? is it insane?
taxilian 13:09 just difficult
IPC is annoying, but if you can make it work that might be a good option
SinnerSmile 13:09 and on mac? Is it impossible to create external window via browser plugin or You are not sure about it?
taxilian 13:09 pretty sure you can't
but if you launch an external app then you could
I have done that before
I communicated with it via stdin/stdout
SinnerSmile 13:09 i'm tootally not familiar with mac programing, is this communication was difficult to make?
taxilian 14:09 not really
I used the boost:process that is in the firebreath-boost tree
(actually, that's why it's in there is because I needed it)
SinnerSmile 14:09 oh ok, right now I just need to know that this is possible to make with reasonable difficulty, now it's too late in my place, will copy our dialogue and woll try to make win32 window via FB later, thx for your help taxilian
taxilian 14:09 good luck