Is there Path Edit Control in Win32? - c++

I would like to add an edit box (or is it a combo box?) for entering a file-path using Visual C Win32 so that it offers auto-complete - the same as when you type in Windows Explorer's address bar.
Is there a common control or property I'm missing that allows me to do that?

You can use the standard edit control and call SHAutoComplete. Like this:
SHAutoComplete(editWnd, SHACF_DEFAULT);
The system will do the rest for you.

There is no Common Control for that. What you can do, however, is use a standard Edit control and attach the IAutoComplete interface to it, which can be configured to use the file system (amongst other things) as a source for getting string values from. The easiest way to do that is to call the SHAutoComplete function.

Related

Add an additional control to a QFileDialog

I am using the Native file dialog, so there is no layout() but want to add an additional control to the dialog. The builtin Notepad application has a perfect example when they allow the user to select the desired encoding (see below, to the left of the "Save" button). Is it possible to add an additional control in Qt5 while still using the native dialog?
TL;DR: Completely custom components are not available with native dialogs, filters can be controlled using QFileDialog::setNameFilters.
Qt's implementation of the native windows file dialog uses ABI::Windows::Storage::Pickers. You can check the implementation out here. Depending on the type of action you perform, the implementation uses IFileOpenPicker, IFolderPicker or IFileSavePicker.
If you want to manipulate the native dialog, this class would have to provide you with the option to do so. We can find the documentation for the FileSavePicker class here.
Going through the available options, you see that there is no interface to provide any specific custom UI element. If you would only need the filter, the QFileDialog provides you with the ability to set a filter using QFileDialog::setNameFilters. If you need a completely custom control/functionality, you unfortunately have to provide your own QDialog.

Selectable file formats at file open/save in MFC in Visual C++

My English is not perfect, sorry.
I am using Visual C++ 2019 Community, with MFC.
At CFileDialog class, I wish choose the file encoding: UTF-16 (little/big endian), UTF-8, ANSI, etc, at saving, with or without signature (2 or bytes what signs the encoding, at the begin of the file). This should be contacted to open/save button. In documentation of CFileDialog, I can add only separate buttons, not extending the open/save button like in Visual Studio, LibreOffice, etc. How can I do this? I am beginner with MFC, and desktop programs, but not beginner with C++. Thank you.
In the comments to your question you state:
Yes, I know. But there is no place to write this. Handler of Open menu is built-in part of MFC. At the source code, CFileDialog is not happen. I added handler OnFileOpen(). This has not paramters, empty at now, and the open menu item manages well. So, I do not know to where I type OFN_ALLOWMULTISELCT.
If you look at Technical Note 22 it mentions:
ID_FILE_OPEN Opens an existing document.
Note
You must connect this to your CWinApp-derived class's message map to
enable this functionality.
CWinApp::OnFileOpen has a very simple implementation of calling
CWinApp::DoPromptFileName followed by CWinApp::OpenDocumentFile with
the file or path name of the file to open. The CWinApp implementation
routine DoPromptFileName brings up the standard FileOpen dialog and
fills it with the file extensions obtained from the current document
templates.
One common customization of ID_FILE_OPEN is to customize the FileOpen
dialog or add additional file filters. The recommended way to
customize this is to replace the default implementation with your own
FileOpen dialog, and call CWinApp::OpenDocumentFile with the
document's file or path name. There is no need to call the base class.
As you can see, it states:
The CWinApp implementation
routine DoPromptFileName brings up the standard FileOpen dialog and
fills it with the file extensions obtained from the current document
templates.
But DoPromptFileName seems to be an undocumented function. You can either:
Debug into to MFC source code to see what it does and override it in your own app class,
Continue to roll out your own CWinApp::OnFileOpen override which uses your own CFileDialog.
I suggest you also read up on CFileDialog constructor documentation because it will assist you for basic customization. However, it sounds to me you need to do what #sergiol said in the comments and display your own CFileDialog (using either approach previously described) and add your own combo with your encoding options. Then handle accordingly.
Please note that I have no experience with that level of customization but it should get you going.

Shell extension windows : best communication between ContextMenu and IconOverlay?

Hello windows experts,
I am searching for a simple way to activate an overlay on files using the context menu. Tortoise SVN gives an example of what can be done. But is very complex compared to my simple need.
For now I am looking at approaching it this way using C++:
http://www.codeproject.com/Articles/545781/NET-Shell-Extensions-Shell-Icon-Overlay-Handlers
http://www.codeproject.com/Articles/10104/Add-a-context-menu-to-the-Windows-Explorer
The issue is to create the link between both of them. The following link suggests to make a map but I am quite puzzle about how:
What the best Language to use when creating Windows Shell Context Menu?
You can use the Registry, for example store an Enabled value in the HKEY_CURRENT_USER\YourCompany\YourApp key. When the user executes your menu item to turn on/off the functionality, write the appropriate value into Enabled and then call SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil). That will cause the shell to re-read icons, including icons from your overlay extension. Inside the IsMemberOf method of your IconOverlay handler, check your Enabled value and return S_FALSE if the functionality has been turned off.

IP Address Control in wxWidgets

In MFC there is a control to enter IP(v4) address called CIPAddressCtrl. Does wxWidgets have an equivalent? Or, do I need to create a custom control?
Thanks
No, wxWidgets doesn't wrap the native Windows IP address control because nothing like this exists under the other platforms and it seems a bit pointless to provide something for Windows only.
The best you can do is indeed use a custom control, which could be as simple as just a plain wxTextCtrl with an appropriate validator.

How to replace/update an ActiveX control in a MFC dialog

I have an older MFC project build in VS 2003 that I want to port to VS 2010. The project uses an ActiveX control for grids, namely, VSFlexGrid7 from Component One. The problem is, that this version of the ActiveX control does not work in Windows 7 (which is what I have). There is a newer version of the grid, namely, VSFlexGrid8 which should be compatible with Windows 7.
The solution would be to replace all the older controls with the newer ones.
My question is, what would be the steps in replacing the controls, without touching other parts of the project. What is the simplest method to accomplish this? Do I have to modify classes, resource IDs, etc.?
[Solution: Replace CLSIDs in the .RC file]
The ActiveX control is bound to the resource file via the guid that represents the control. If you were to look inside the .rc file you will see the control with the associated guid. In your case, it's probably best to completely remove the control from the dialog (using the resource editor) assuming that you can drag the newer version onto the same dialog. Once you've done that, you'll need to generate a new class wrapper for the control. The class wizard should be able to handle that for you. Once you've got a new class wrapper that represents the control, you'll need to replace the prior wrapper class in your source code.
Usually the control is created somewhere in your dialog code with CreateInstance.
If the interface is compatible (I assume it is) , you just have to change the name or GUID that is used in the CreateInstance Code.