Is there an API in Windows 7 for creating "split menu items"? - user-interface

I don't know what their official name is, but I mean these things:
Is there an official API for creating those in my own program?
And related question: Did you ever see these "split menu items" used anywhere other than the start menu? Where? This could point at an API.

Glancing at my own start menu, I'm guessing that most are generated the same way "Recent Documents" used to be done. i.e., observing the files that programs open.
As for new APIs, this page might be a good place to start sniffing around: http://msdn.microsoft.com/en-us/library/ee461765%28VS.85%29.aspx

To create tasks like internet explorer etc, use ICustomDestinationList->AddUserTasks(), the recent items should show up for file types you are registered to handle (They are added by the open/save dialog or manually by calling SHAddToRecentDocs())

Related

Handle GUI window changes

I'm doing an automation script for installation wizards using AutoIt. I'm trying to handle window changes in some way.
Can some one explain how these GUI's work?
When I click on the Next button it looks just like the components in the GUI is beeing changed. Is this tha case? Or is a new window created and the old destroyed?
I've noticed that the process ID is the same for all windows.
I'm sure there is some way to know which "state" the GUI is in, or which step?
By the way. All the windows has the same title.
Thanks
/Anders
This will be dependant on the program you are automating.
The easiest approach would be to look at what changes in the GUI between stages, likely candidates are if there is a label that is giving instructions for that step, or a button that has text changing (e.g. if the button says "Finish" then you know your at the end).
Most installer programs have child windows for grouping the controls of each stage. These are typically implemented as dialog resources (as can be seen when using something like reshacker on them). So although the window remains the same, the panels are being created/destroyed as appropriate. This is a very neat method of doing it, for the obvious reason that you don't need to have to code to create/destroy a lot of controls. Resource created dialogs don't have nice class names like windows sometimes do though, so this may not be a reliable way to check the state.

Controlling multiple Internet Explorer windows?

We've got several web-based applications that are launched from our ERP system (SAP R/3 in this case, but since we're using ShellExec, I don't consider this a SAP issue). The problem is that we can either set the IE to "open every URL passed from the ERP system in a new window" or to "reuse any one of the existing IE windows" (same problem with tabs). Both settings are not acceptable for our users: one of the web applications is a rather bulky medical image viewer applet that wreaks havoc if invoked multiple times. The other option is a no-go either because this way opening the image browser for a patient automatically displaces the lab result display for the very same patient and vice versa.
I'd like to have some control over which window may or may not be reused. My idea would be a kind of "window tag" and a helper program that checks if a window with that tag exists - if it does, reuse it, if not create it. So basically
IELauncher SEARCH http://www.google.com
would open a new window and tag it as SEARCH.
IELauncher DEVEL http://stackoverflow.com
would open a second window, tagging it as DEVEL. Then
IELauncher SEARCH http://www.wikipedia.org
would replace the contents of the first (google) window only.
Is this possible at all? Do you have any pointers for me where to start? I don't even know what to look for...
I had to resort to some rather ugly methods - dynamically assembling a HTML page that uses JavaScript and window.open() to open and access a window by name, then close the page executing the JavaScript. Ugly, but at least this way you get the additional benefit of being able to control certain aspects of the browser window like switching of the menu bar, toolbar and location bar.

IFileSaveDialog - choosing folders in Windows 7

In Vista, I have been using an IFileSaveDialog to let users pick a "save-as" folder. Users export a folder of images, say, and need to choose a new or existing target folder.
Briefly, the code goes like this:
IFileSaveDialog* dialog; // created
dialog->SetOptions(FOS_PICKFOLDERS);
dialog->Show(NULL);
dialog->GetResult(&shellItem)
In Windows 7, the FOS_PICKFOLDERS option appears to have been disallowed (and is marked as such in the API). The return value on the SetOptions call is E_INVALIDARG. If I use a IFileOpenDialog, I'm allowed to set the folders option, but the user is prompted with an error when choosing a nonexistent folder (despite my setting flags suggesting not to do this).
Is there an alternate way to get the new IFileDialog to act as a "save folder" dialog?
[To head off some comments, the SHBrowseForFolder API still exists, but is still not an acceptable solution for our UI deciders.]
The reason for this can be found in the documentation:
FOS_PICKFOLDERS: Present the Open dialog offering a choice of folders rather than files.
Using FOS_PICKFOLDERS for "save" was never supposed to be supported - but Vista didn't enforce it. Use IFileOpenDialog instead and you're good to go.
You are picking an existing folder (not specifying a folder to create), so open was always the correct choice.
I haven't played around with the Windows 7 dialogs yet, but downloaded the Windows® API Code Pack just this morning as I am implementing the Thumbnail Toolbar and Icon Overlay in the application I am working on. It'll probably point you in the right direction.

How can I use standard WiX to create a streamlined installer experience?

Background:
Currently, we have created a wizard by WiX UI. The user should click next, next and next...
But suddenly, we found that there's nothing should be interacted with user, user just need keep clicking next. So..
Here is the desired behavior:
We automatically switch to the next dialog page after all the stuff (such as pre-check and so on) done in the current page. Once there are errors in installation process, we show the error page to the user. That makes for a streamlined installer experience for the user. One click, everything done.
Can WIX do this kind of stuff purely, or should I need some other work to do to implement this?
No, you'll need to define your own external UI handler (like the MS Office installer does) if you want something "fancy" - why not just remove the UI altogether? We do this for a number of setups....
Take a look at WixUI_Mondo, WixUI_Minimal and other predefined UIs that come with WiX. Otherwise you can define your own dialogs and their sequence.
You can try with Wix_minimal or you can go for your own customized dialog boxes.
You can also customize the sequences of the dialog boxes by your own need. I suggest you to do the second option.

Is there a simple way to change the text of the 'Open' button on the windows file dialog to 'Select'?

We're using the file picker dialog to allow users to add documents into our application. The word 'Open' doesn't make a lot of sense in this case.
Thanks.
I would browse the code found here, which shows how someone extended the OpenFileDialog. Admittedly, this is overkill for you. But I think there is code within to change the button label.
Not really no.
Given the standardization of this dialog it's extremely likely that your users will have used it many times in the past to "add" files to applications. The chances are they will be quite familiar with the implications of the word, changing it may be more confusing to them.
The standardness of the dialog is why it's called a "Common File Dialog". If you want to change it for your app, you'll have to write your own dialog.
Having said that, there are apps out there that can pull a form out of a DLL, modify it, and stick it back in. However, this is a per-machine hack and downright bad form.

Resources