Here's a problem that first solved many years ago, forgot about, and had to solve in a new bit bit of code recently. My poor documentation originally and deficient memory since then cause me to waste an hour re-fixing the problem -- at least I knew I had solved it before!
I have a utility that uses embedded browser controls that contain java applets. These browsers are launched in the background and operate without user interaction until activated by a controlling GUI interface.
Many years ago Microsoft released an IE update that, as part of their settlement with Eolas meant that embedded ActiveX controls were more of a pain to work with because of a "click to activate" policy. While this has since been resolved in a later update, an odd behaviour traced back to that initial ActiveX update remains in place causing a headache:
When I launch a process that embeds a web page containing an applet, the applet does not initialize (even though the Java Console is there) until the tool containing the browser control and embedded page is somehow displayed on the desktop.
The scenario is as simple as a Win32 app started with this general approach:
hwnd = CreateWindowEx(...);
ShowWindow(hwnd,SW_HIDE);
UpdateWindow(hwnd);
Until hwnd is somehow activated on the screen via some other method, the Java plugin for the applet included on the embedded page starts up but the applet does NOT initialize. As soon as the hwnd is displayed, the JRE initializes the applet.
To avoid this problem, it's as simple as adding in an initial hwnd activation:
hwnd = CreateWindowEx(...);
SetWindowPos(hwnd,HWND_BOTTOM,0,0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),SWP_NOACTIVATE);
ShowWindow(hwnd,SW_HIDE);
UpdateWindow(hwnd);
With this change, the hidden applet merrily initializes and does its normal startup work.
Monday, June 22, 2009
Subscribe to:
Post Comments (Atom)
Titanium Tube : BaoJitanium.blogspot.com
ReplyDelete› 목포 출장마사지 T-16 › 창원 출장마사지 titanium-tube-b › T-16 › titanium-tube-b This is the T-16. We'll add the metal tube to 충청북도 출장샵 our base for a better fit. I also 오산 출장안마 have the aluminum tubes to be inserted and titanium tubing put to the bottom.