Document Mode menu functionality in Web Browser Control - mfc

I'm writing my own MFC app that uses WebBrowser control (uses IE9). I wonder how can I use the API similar for "the document mode menu" in IE Developer tools : http://msdn.microsoft.com/en-us/library/dd565626(en-us,VS.85).aspx#docModeMenu.
Especially I'm interested in the functionality described as:
"This command allows you to modify the chosen document mode of the current page without modifying the DOCTYPE or META tag in the source"
Is it feasible?
10x,
Guy

It's difficult to tell what you're asking for here, but it sounds like you want to programmatically set the Document Mode (Strict or Quisk) at runtime.
If this is correct, you can't! (At least, programmatically.) The closest thing you can get is to add a Windows registry key that specifies the conditions under which you want pages to load with particular Document Modes. Something like this:
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl
\FEATURE_NATIVE_DOCUMENT_MODE]
"YourApp.exe"=dword:13880
Then, every time your application loads the WebBrowser control it will get access to this registry key and your control logic can decide what to do from there.
Hope this helps. Good luck!

Related

Make windows 10 narrator to speak some text

I'm making a GUI application in C++.
Is there a simple way to make the narrator of windows 10 to speak some text ?
Given of course that it is currently active.
A trick that sometimes works is to select some text in a text field and then focus it briefly. But
It doesn't work all the time
The focus is moved out and back. Even if it's for a short time, it's invasive and may disturb whatever the user is currently doing
The text field must be present at some place on screen, what is not always desired
If possible, I would like a solution without these three issues.
Other screen readers, in particular Jaws and NVDA, provide API to do this.
I'm even the author of a library, UniversalSpeech, which allow to make the currently running screen reader, if any, to speak text, abstracting the need to detect yourself which one is running.
Given that the narrator has greatly improved with the last 3 or 4 releases of windows 10, it would probably be interesting to support it, not only in my own program and for my particular usecase, but for everybody in my library.
However, I can't find any documentation or anything telling me if the narrator has an API similar to those of Jaws or NVDA.
In fact if there is currently no such API for Narrator, it would probably be interesting to suggest Microsoft to add one.
Note that this question is different from such as this one
where the answer suggests to use speech API directly. Using screen readers API and not speech API directly has great benefits:
Screen reader users are used to specific voice settings (voice, rate, pitch, language and regional accents, etc.). The default settings set in the control panel may not at all be similar. It implies
whether the user must configure speech settings in the control panel, what is global for all applications; not very good
and/or managing application-specific speech settings in a business application which isn't at all devoted to speech stuff; it would be rather strange to find speech settings in a financial app for example.
Using both screen reader and independent speech engine simultenously means that both can speak at the same time, what is of course extremely annoying. In fact in practice it happens quite often, I have already tested.
So, is there a simple way to make narrator to speak some text ?
My program is in C++, the library is in C, so in theory I have access to the whole winapi, through LoadLibrary/GetProcAddress if needed.
Please don't give any C# or VisualStudio-dependent solution.
Thank you.
After quite a while, I answer my own question !
IN fact, the simplest to make narrator speak something is probably to:
Define some label as being a live region
When something has to be spoken by narrator, change the text in the label and then send an update notification
Turning a label into a live region and sending a notification whenever the text changes is explained here:
https://learn.microsoft.com/en-us/accessibility-tools-docs/items/win32/text_livesetting
Live setting can be set to 0=off, 1=polite and 2=assertive. The meaning of polite and assertive are the same as in WAI ARIA.
Though as present (april 2021), narrator always interrupts speech as soon as the text of the label is replaced, even in polite mode.
What changes in assertive mode is that the text even take priority against interruptions due to normal keyboard navigation, i.e. you may not hear where you are when pressing tab, arrow keys, etc.
For that reason, I don't recommand it at all.
Note also that live setting only works on static text controls (win32 STATIC window class).
It is totally ignored when applied to text fields and text areas (win32 EDIT window class).
The label with live setting still works when placed off-screen or even hidden.
As far as I know, Microsoft Narrator doesn't expose the API for developers, and you can suggest a feature for it using Feedback App on Windows 10.
I want to achieve the same behavior as in a live region, i.e. have some text read by the SR as it appears at the bottom of a multiline rich text field, but in a native GUI app. For info, I'm using WXWidgets.
You can use the UI automation events to subscribe the property change of rich text field so that you can get notified when the text is updated. And since you are using third-party control, you also need to implement providers for any third party controls that do not include a provider. And below are links about UI automation provides and
UI Automation events for your reference:
UI Automation Events Overview
UI Automation Providers Overview

How to extend Ranorex for a native UI toolkit?

In our company we use a native win32 UI framework written in C++. There are several controlls where Ranorex Spy doesn't "see" any useful information for identification or verification.
Is there some API in Ranorex that can be used to make it compatible with such a framework?
Changing the framework to make it more Ranorex-friendly is not going to happen (company politics).
I've had a similar issue where the application I'm testing has a list box, with items in it, however Ranorex was not picking up anything beyond the list box. In fact, it actually recognized it as a plain 'Element', rather than a list box.
To fix, try this...
Right click the object (in my case it was the Element)and click "Add process name to GDI capture list".
In my case, it added a bunch of text objects under the Element, which enabled me to actually "See" the info I needed.

WinCE 6.0: Customizing Control Panel (cplmain)

i work on a Windows CE 6.0 Image and added a Audio driver to my Solution (my solution is based on a image without audio). Sound works fine but i dont know how i can add the standard Windows CE 6.0 Sound Settings dialog to the control panel.
MSDN says the following:
"The Windows CE Control Panel allows users to set a variety of system-wide properties, such as mouse sensitivity, network setup, and the desktop color scheme. You can select specific functionality to include in your Control Panel by specifying them in your Cesysgen.bat file."
Can anyone explain how this works exactly via Cesysgen.bat? In my project i cant find any entry for cplmain in my Cesysgen.bat.
Could it be that those standard Applets are integrated into the control panel automatically? (maybe with "getProcAddress()" when a specific driver is loaded?) - This idea comes from "cplmain.def", there is written:
EXPORTS
CPlApplet
; These functions are exported for componentization
; We use GetProcAddress on ourselves to dynamically discover
; what components we have
I found a quite good explanation from Andrew Pearson here:
http://www.itlisting.org/4-windows-ce-embedded/a57eef4103191b7a.aspx
but i tried a few different things an nothing worked! So this confuses me even more. The only statement there i really understand now is:
The control panel, unfortunately, is about the single most confusing thing
to build in the whole tree.
Yes it is! Would be nice if anyone had an idea.
Kind regards,
Martin
I've created custom control panel applets before, and to be honest, trying to modify the existing applet is about the worst thing you can try. Generally what I do is just create a whole new applet, which is really just a DLL renamed to have a .cpl extension and that exports the CPlApplet entry point.
There's an example in MSDN that shows the expected values the OS will pass in to get your icon, tell you to start and those types of things.
Basically just build your own applet as a completely separate project, then include it in the MODULES section of your BIB file. Don't even mess with the existing train wreck of control panel code.

Controlling Internet Explorer in order to enter username/password

I was looking into trying to get my C++ application to do the following:
Open internet explorer
Open a webpage
Enter a name and password into specific forms in the webpage
Click the submit button on the webpage to open a new page
From my searching on the Internet it seems like using COM may make this possible, although I may be incorrect on that. I am doing my best to learn COM at the moment but some help would be great. I'm looking to do this without using MFC.
I have noticed this question which I kind of what I am looking for but I am having trouble understanding the suggested solutions. For example, I do not have a IWebBrowser2 option in my toolbox.
EDIT:
To make my question clearer, I had this task complete in a C# version by simply running a coded UI test but this will not work with C++. I am looking to open IE (not in the application itself), find the username and password forms, pass them string, then find the submit button on the page and click it.
This is very possible from c++. You will have to dive into the winapi to do some Keystroke stuff as well as window handling.
I'm not going to go into all of the code, but you have to do something like the following:
Start ie (if you give it a command line arg with the webpage, it will
open that page).
Make sure the ie window is focused (either just wait
if you want to keep it simple or use window's api to go through each
open HANDLE and find the window you want)
Use SendInput to send an Alt + D (to gain focus to the url bar, in firefox it will be a CTRL + L instead)
Use SendInput and javascript injection to modify the DOM as necessary
You can also submit the form (after everything is as you want it) using the above JS injection capability.
Yes, it is possible, but you have to embed a web browser control in your application, and it is not straightforward (I don't think you can automate DHTML in an external instance of Internet Explorer via COM).
I see that you don't want to use MFC, and this complicates even more the problem. Perhaps you can do it via ATL, I advise against even trying to do it without a framework.
If you could use MFC, then you could use a CDHtmlDialog form and access the underlying COM interfaces to automate the actions.
In the past, I developed an MFC application that used HTML as its user interface, but I used the CDHTMLView class that you can find here: http://www.codeproject.com/Articles/1783/Integrating-DHTML-into-MFC-Views
You can use this as an entry point for learning how to deal with DHTML events and how to play around with the IWebBrowser2 interface.
You should really take a look at WebDriver which is able to do exactly what you are describing. See (http://code.google.com/p/selenium/wiki/InternetExplorerDriverInternals) for more information about the InternetExplorerDriver internals. Even if you are not able to use the project directly, you can certainly browse the source to get a better idea of how what you want to do can be achieved.
What you want to do makes not much sense.
There are many APIs available to embed a browser view into your program. For example Qt offers this.
Then you can just do your HTTP POST request yourself and display the answer you get in your browser view.
That is a much cleaner solution.
Pro tip: Don't use Internet Explorer.

Extending Filenet P8 3.5 Workplace with custom GUI and code

I'm not familiar with Filnet P8.
My assumptions from reading some online docs is that it has a central web-based user interface called Workplace which is implemented on the Java web stack and communicates with the core parts of Filenet through Java APIs.
Also it seems you can extend the Workplace trough JSR 186 compliant portlets. - from what I've read Filnet P8 Workplace is not a portal itself and cannot host portlets, but provides some of the functionality as portlets which can be used with 3rd party portals.
Filenet also seems to have a lot of extensibility points which don't require coding, but I'm considering a highly-customized application with custom dynamic grids and forms.
Is it possible to extend the Workplace using portlets and/or plain JSP/Servlet approach with custom GUI for a custom workflow? (Probably the "Web Application Toolkit" is the tool)
The GUI can contain grids with filtering and column selection, forms (not paper once) with dynamically disabling/enabling fields, custom search forms, dynamic context and dropdown menus.
The GUI should be able to integrate with the Content and Process engines of course.
A link to an existing Filenet P8 based solution which proves such a custom Workplace GUI extension possible would be great.
Thanks!
This is possible. First of all Workplace comes with FULL source code. Look in the AESource directory (usually in c:\Program Files\FileNet\AE if you are running it on Windows). What you need to decide first of all is where you want to plug in (for example do you want to create a new Wokrplace page altogether like the Browse and Search pages or do you want to splice it in as a new action like Checkout, Get-Info etc).
Once you figure that out, I can provide more specific information of where you want to look to add your new code. Once you can display an entry point to your own feature in Workplace, then you can use whatever you want as far as controls etc. You can use JSF grids or just classic JSP stuff or even JQuery controls (provided you link the right libs etc).
Another thing to keep in mind is that you are going to need to get familiar with the Web Application Toolkit (WAT) so that you can make sure you are getting the right state information from Workplace (like the user token of who is logged in, maybe what doc id the user clicked on, what folder they were in when they entered your UI).
Anyways, here is some info to get you started. If you provide more info about where you want to splice your UI in, I can provide some guidance as what you need to change etc.