Using NPAPI to detect browser minimize - plugins

Is there a way to use NPAPI to determine whether the browser is minimized.

Not directly. Depending on which platform you want (you should really specify things like that) there might be a way.
For example, on windows you might be able to get the browser HWND (NPN_GetValue with NPNVnetscapeWindow) and then check the state of that window with windows API calls.
On mac you're going to have a harder time of it; you could possibly intuit from the clipping information passed into NPP_SetWindow, but that doesn't tell you if the browser is minimized or if the plugin (or even the tab) is just not visible. Again, you'd need to try to figure out a way to use system calls to find your way back to the real window, but on Mac that's going to be very non-trivial.
Linux I'm not sure; you get a GtkSocket if you use XEmbed (only thing Chromium supports) and I haven't a clue if you can use that to get back to where you'd need to be to check minimized state.
So the short answer is no; NPAPI doesn't provide anything like that. You'd just have to try to find something that it does provide that gives you enough info to hack it.

Since I was using Core animation layer. I put in a timer which checks how often the candraw call back is called. If the time difference between the two callbacks are greater than a second I assume that either my plug-in is minimized or hidden.

Related

Unity C#: How to rebind buttons via script while game is running?

Title says it all, I'd like to implement a controls menu so the player can rebind controls, which changes the positive input key of a button in the Input Manager. But I can't find anything about it online.
How would I go about changing the positive key for a button while ingame?
Unfortunately, I believe you can't set Input Manager values via code at all. That's probably why you didn't find anything about it.
You've got two alternatives:
Use the "Input System" aka. the new input system that is available as a package. It is not as easy to use as the legacy input system, but you should check it out. It's also open source.
Use an asset store package. I've tested Rewired in the past and found it extremely powerful, especially compared to the legacy input system.
Personally, I'd first go with option 1 and see if you are happy with it. It's an official package and not 3rd party. Option 2 is still there, if you have issues with option 1, but it'll probably cost you money.

VBA hide form from menu

I'm trying to hide a form from the menu using VBA; I've Googled this, but everything is giving me the .visible option, however I want to hide it from the groups menu located on the left side. I could just as easily manually do this, however it's very tedious and I can't be going on other user's computers to do so.
Is this possible?
I might suggest normally you should only disable menus vs. removing them all together, might suggest doing an enable/disable menu item instead..
It should be possible but how much work is it and is it worth it to you? It isn't clear what your host application is just that you're using VBA. Might suggest the host application may already allow for customization if so use what it provides.
If the app doesn't allow customizing your menu you can still do it, just how much work is it worth for you? You'll need to look at the Win32 way of doing things. If not familiar with Win32 and menus take a look and start here looking here at MSDN to start learning about menus in Windows. After this you'll find Pinvoke will be handle to give you C#/VB sample to call what is needed. The VB should be useful but you will probably need to further translate the VB to VBA for your needs. FYI when starting out a a C/C++ developer back in the day 30 years ago it was anticipated anyone getting into windows might take them a few months, there is a lot you'll need to get up to speed on. Thus is this feature really worth it?

How to access electron app's current browserWindow?

I'm stuck on a particular point with my Electron app:
When I open the devTools, I call mainWindow.webContents.openDevTools() from the app's menu. It's working fine on mainWindow.
The problem appears on child windows, opened by window.open(): the app menu is still working on every window, but it always call mainWindow's devtools (which is normal, since I told it to do so), where I would like to get current window's ones.
So I wonder if there is a way to call something like currentWindow.webContents.openDevTools() ? I found nothing in the documentation nor on SO nor by googling, so I guess I might haev missed something.
Let me precise a few things:
I'm still a newbie with Electron
I have no control on the pages that are called in the app, I'm trying to use electron as a kind of "restricted browser" to ship with a PHP-based application
After a bit more reading, I just found out that BrowserWindow.getFocusedWindow() is exactly what I was looking for.
So in my app menu, I juste call BrowserWindow.getFocusedWindow().webContents.openDevTools(), and it works as I expected.

Assign command to the central soft button within javaMe

I have the mobile javaMe application that has been working on Nokia Phones. However, now I'm porting it to Samsung 5611, and I've faced with such a problem: no command is assigned on the central soft button, all of them are contained in the right-button menu. When the same midlet was launched on Nokia 3110c, one command was placed on central button, other ones (if >=2) were grouped into the options menu.
I tried Item.setDefaultCommand (no effect) and Display.getInstance().setThirdSoftButton(true) (such method not supported in SDK 3.4). Also I tried to change the type of one command to Ok or Screen, and change the priority, everything is without success.
Thanks in advance. Any idea will be helpful.
Sadly there's no way for the developer to decide exactly on which softbuttons the commands belong. It is the individual device that decides. Some devices has two softbuttons, and some has three.
You can fiddle a bit with priorities, but you still can't force commands to specific softbuttons.
That's high-level GUI (Form) for you.
If you want to have control of such things, you need to go with low-level GUI (Canvas / GameCanvas). Nowadays there are several APIs you can use to create Form-like low-level GUI. Check out LWUIT for example, which I imagine makes it easy for you to port your high-level code into low-level.
But even when using low-level coding, you have to be aware of different devices having different keycodes for the softbuttons.

Embedded MSHTML: mouse wheel ignored

In my VC++ application I have an embedded browser (MSHTML). It works fine and handles the mouse properly (for instance, clicks and selects are processed OK). However, mouse wheel rotations over the embedded browser do not have any effect. This is my problem.
I am not very familiar with the internals of MSHTML embedding, and OLE in general. This is an wxWidgets application (wxWidgets is a C++ GUI library), and I am making use of its IEHTMLWin component (which hosts an MSHTML control and wraps it in the wxWindow interface). However, I do have the source and am willing to do some debugging.
Forgetting wxWidgets and speaking purely about OLE and MSHTML, what's the right place to start looking for the problem cause? I tried naive googling for variants of "mshtml mouse events" or "mshtml wheel", but didn't give any good pointers.
Should you want to take a look at the code of IEHTMLWin, it can be browsed here. The iehtmlwin.c file (1,5 k lines) has all the OLE-related code and implements all interfaces needed to host a web browser control. It's worth noting that mouse events don't proceed to the containing wxWindow at all (OnMouse is never called).
{UPD} mshtml version: 6.00.2900.3314. Other applications that host this control (including IE) support the wheel. {/UPD}
jdigital hint (regarding winspector) was very helpful. After some message sniffing, I realize that the problem is focus-related. A click on the browser control somehow does not set focus on the browser control (unlike, say, RichEdit), and WM_MOUSEWHEEL is not sent there. So the new problem is setting the focus.
Try Winspector (http://www.windows-spy.com/) which will allow you to see the windows messages. Make sure that the scroll wheel events are getting passed through.