WinCE 6.0: Customizing Control Panel (cplmain) - c++

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.

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 add custom menu upon right click on file / folder programmatically in c++ / QT?

We have an app which syncs files and folder like the way dropbox does. This is an c++ / QT based installer.
We would like add custom menu in the right click context menu of a file or folder like the way dropbox does in the below screen shot.
We are targeting both windows & Mac platforms. Can anyone suggest me how to start with it?
On Mac, you're going to have problems as adding to the general Finder Context Menu has been deprecated.
So, you may be thinking, if it's deprecated, then how do Dropbox do this? From what I've researched in the past, I believe they use code injection to inject into the running Finder application's address space and then an Objective-C feature known as method swizzling to change calling a method to one of their own, which is located in the injected code.
This is all fairly hardcore and very low level, but if you're going to go on that journey, you can start by looking into a library called mach_inject and googling about it. The source code can be found here: -
https://github.com/rentzsch/mach_inject
However, be aware that there are those that believe code-injection is wrong and won't install Dropbox or any other software that uses it. In addition, if you're planning on releasing a product in the Mac Store, I wouldn't expect any application that performs code injection to be allowed.
For windows, I could find a complete Shell extension example over here.
http://www.codeproject.com/Articles/441/The-Complete-Idiot-s-Guide-to-Writing-Shell-Extens?fid=519&select=3236397&fr=76&df=90&mpp=25&noise=3&prof=True&sort=Position&view=None&spc=Relaxed

How to Skin an Win32 Application

Win32 look nasty, how to make it look better by custom skins?
I mean something like Adobe products, iTunes, Autodesk 3dsmax and Softimage XSI, Windows media player, Blender, Comodo firewall, Winamp, Babylon client, and few download managers etc.;
there are many similar applications out there but I can't find any proper tutorial or guideline, it looks like secret recipe!
only -two- tutorials available online:
old and useless: http://www.codeproject.com/Articles/20497/Draw-Skin-Window-Using-Pure-Win32-API
only cover opaque background (and this is what I avoid, I need more about GUI components):
http://www.flipcode.com/archives/Win32_Window_Skinning.shtml
Is there any book or proper guideline to learn how to build skins for Win32api?
Edit: I accept David Rodríguez comment, down there ↓↓
I have done this before using C++ Builder. The approach I took was to create a form, set it to be borderless and color the entire form the same color. Then I set the form transparency to this color. I then add images to the form which create the desired skin.
I'm sure this can all be done through standard win APIs, but I can't describe (or advise) doing it solely through API calls.
The operating system handles "skinning" for you automatically.
In "classic" mode (or Windows 2000 and earlier versions), this gets you a, well classic-looking interface. The windows are drawn just like they always were since Windows 95. Presumably, this is what you are referring to when you say that "Win32 look nasty". However, you need to realize that many people like this look and specifically choose to enable it on their machines. [WARNING: Personal opinion coming up!] I'm one of those people, and judging from the screenshots that get posted here from developers' machines, I'm definitely not the only one.
Windows XP actually introducing the "skinning" or theming engine, which lives in a set of Windows DLLs. By explicitly linking to version 6 of ComCtl32.dll, your application would automatically get these visual effects. Some people said this version of Windows looked "Fisher-Price", while others were perfectly happy with the term "gaudy". The option was retained to allow the user to switch to the "classic" theme (as described above), if desired.
Windows Vista completely overhauled Windows's theming engine and introduced a new UI known as "Aero". This provides flashy-looking windows and controls, complete with transparency effects—that is, as long as your graphics card supports it. Again, by explicitly linking to version 6 of ComCtl32.dll, your application would automatically get all of these styles applied.
It's worth noting that through all of this, Microsoft has provided users with the ability to customize the colors (and fonts and other things) used in the user interface. For example, Aero defaults to blue. If you don't like blue, you can change it. I change my UI colors periodically for fun and to re-energize myself. If you can't read or don't like the font, you change it, too.
Thus, if you choose to do something different with your application, defining your own custom color palette and ignoring the options chosen by the user through the provided customization interface, your app is going to look broken and stick out like a sore thumb on the user's desktop. When designing a UI, the last thing you want to do is to be or look different.
In short, upgrade your computer to Windows Vista or later and enable the Aero interface if you want flashy. Don't override the user or try to custom draw all of your controls. You'll just end up with an application that is hard to use, doesn't work as expected, is a pain in the rear to maintain, and just generally looks worse than if you'd simply left it alone.

Look for ways to enable printing from my C++/MFC application

Since time immemorial I've been trying to avoid printing from my Windows-based applications due to the lack of native support for it. Whenever absolutely necessary I was resorting to dynamically making a simple HTML layout and then opening it in a web browser with a short Java Script in it to pop up a printing dialog for a user. Now I need to find something more substantial.
Let me explain. I have a project that deals with medical charts and it has to be able to print into those charts (at specific locations) as well as print on to a Letter/A4 size page in general. It also has to provide a preview of what is being printed in a paged-view environment.
In light of that I was wondering what is available from MFC/C++ environment (not C#) in regarding to printing?
PS. I was thinking to look into the RTF format but that seems like quite a daunting task, so I was also wondering, is there any libraries/already written code that can allow to compose/view/print RTFs? If not, what else is out there that can provide printing support like I explained above?
"lack of native support"? It's been covered by Petzold since forever, and it's integrated straight into GDI. Compared to UNIX, it's a complete breeze. And MFC makes it even easier.
Anyway, here's how you do print preview with MFC, and here's how you subsequently print. Lots of links from there, and it's all straightforward. Printers are just another Device Context on which you can draw.
I always found it very convenient to generate PDF files from my MFC/C++ application, There are many libraries out there which enable easy creation of PDF files, preview functionality and so on (also open source). I'm using this (also handles RTF):
PDF Library
There is no support like you call a framework method with some parameters and the framework prints a document or the content of a window for you. You need to manually draw everything on the printing device context. So as already said, you might find it more convenient to use a PDF generator, but of course that depends on your application requirements.
Please try www.oxetta.com , it's a free report builder solution that easily integrates into a C/C++ application.

What's the easiest way to find a given control in a external program's window?

What is the best way for, using WinApi, find a given control in a external program window?
For example, I'm trying to change Internet Explorer's url text box. I am having trouble getting programatically the handle to the text box. I know its type is "Edit" but I'd like to avoid having to search through all the child windows for the "Edit" control (that's how I'm currently doing).
Is there any kind of unique identifier for a given control on a window? I tried using "Control ID" but it doesn't seem to be working.
Thanks
When you're delving into the windows of another application that wasn't designed to give you any particular special access to its windows, then you don't really have any simple solution. Functions like FindWindowEx, GetWindow, EnumChildWindows, and the rest are what you have to work with.
However, it's often not a great idea to even do this. Internet Explorer may have certain types of windows in a certain hierarchy in the particular version that you're developing against right now. But those windows and hierarchy may be different in previous versions and could be considerably different in future versions. You have no guarantee about these things.
In some cases, you might do well to investigate if there are alternative and more official ways to control the other program. For instance, Internet Explorer exposes a COM object that can be used for many purposes. Because this is an official interface, you have better guarantees about what previous versions this will be supported on and that it won't break for future versions.
The best way to do it is find it step by step.. E.g. Find the IE window with FindWindow, then find the child of that with FindWindowEx, then find the child of that with FindWindowEx ... until you get down to the textbox.
There is 1 program I can think of that will generate VB code from dragging a icon from the application to any part of any other application.. VB is way old but it'll give you a very good idea how to do it!
It's called API Spy, found under 'Downloadable Applications (Windows Only)' on http://patorjk.com/blog/software/