CMFCToolTipCtrl or CTooltipManager examples? - c++

Has anyone tried using these new VS2008 MFC classes yet? I can't seem to find any examples anywhere. Even the VS2008 samples(1) don't mention these classes. (They use CToolTip.)
(1) Update: My mistake. I had downloaded the non-SP1 samples. I see that the SP1 samples have samples specifically for the 2008 Feature Pack, including the DlgToolTips and ToolTipDemo projects mentioned in an answer. Unfortunately, they don't address doc/view or CTooltipManager.
Specifically, I'm trying to display tooltips in a standard MFC view/document application where there are two side-by-side views whose parent is CSplitterWnd. I had this working pre-SP1, and I thought this'd be a good time to try the new Feature Pack tooltip classes.
Is there any way to make these things work without overriding PreTranslateMessage() and manually calling RelayEvent()? (I don't think I've seen anything in MFC as poorly designed as tooltips.)
It doesn't seem as simple as merely calling CTooltipManager::CreateToolTip() and then AddTool() on the created tip.

In case you haven't seen it, there is a very brief example here

Have you looked at the DlgToolTips and ToolTipDemo sample applications? These both use classes which inherit CMFCToolTipCtrl. DlgToolTips includes code that calls RelayEvent from PreTranslateMessage, but ToolTipDemo doesn't.

Related

VSIX Project - Properties tool window extension

There might be something wrong with the way I search for things but here is my problem. I'm looking for a way to implement a custom editing tool within the properties tool window in the Visual Studio editor. I've been looking through several documentation references, and they all lead to the use of different assemblies, but I can't get anything to work the way that I want.
First of all, I tried using the UITypeEditor class, with the step-by-step tuto I found here : https://learn.microsoft.com/fr-fr/dotnet/api/system.drawing.design.uitypeeditor?view=net-5.0
The problem I faced was that it only seemed to be working with Winforms projects, and I'm trying to use this with a WPF project.
Afterwards, I tried following this tutorial, in order to create a project template : https://learn.microsoft.com/en-us/visualstudio/extensibility/creating-a-basic-project-system-part-1?view=vs-2019
This has led me to think that the methods used in the tutorial might have been either deprecated or improved with the used of AsyncPackages instead of ProjectPackages, and the appearance of the Microsoft.VisualStudio.Shell.Flavor assembly that seem to render useless the ProjectNode class (it doesn't even show up anymore, the method has been replaced with a void).
The last bit I tried exploring was the use of the ProjectSystem, as documented here : https://github.com/microsoft/VSProjectSystem
It was actually worse because I couldn't get it to work like I wanted, the project type I was creating could not register C# files and I wasn't able to add new classes (I might need to dig a bit deeper here but I don't know where to look).
So basically, I'm looking for help to extend the properties tool window, through an editor within the window, or a modal window opened by clicking on an ellipsis button in the properties window.
Thank you for reading this, if you have any info, I'm very interested.
I've actually found a thread leading to what I was trying to do here. This tutorial leads to a way to implement a customized editor, either inline, extended or in another dialog window. This was the thing I needed, and with a few tweaks I managed doing what I wanted.

Debugger visualizer of GDI objects for unmanaged C++

Technically, is there a way to show images (bitmaps, icons, cursors) directly inside the watch window? As far as I know there is no way to do that via autoexp.dat. (If not, a tool window will also do.)
How can I transfer the image data from the debuggee to the debugger visualizer?
What other (see below) resources or sample code exists for the problem at hand?
Aside from the MSDN documentation and examples, I found this: http://www.idigitalhouse.com/Blog/?p=83 ... however, it "only" covers textual data. Virtually all other information was superficial (only covering "default" features of autoexp.dat) or for managed code.
Basically I am looking for this, but for unmanaged debuggees. The linked visualizer does not appear to work with unmanaged (C++) code, I tried that.
Is there any solution for native code at all?
I've eventually stumbled upon your question while googling. I had exactly the same question, only for OpenCV, not GDI images. I found there is no simple solution for this task. However, I've implemented one based on Visual Studio Debugging Expression Evaluator Add-In.
My implementation is available as a VSIX package named NativeViewer at SourceForge. If you need, you can adapt it to work with GDI images instead of OpenCV.
Have you seen my FeinViewer? I stopped supporting it for the lack of interest...
http://feinsoftware.com/FeinViewer.php
Aside from the visualizer by Mikhail, there is this one:
http://victorhurdugaci.com/projects/vsimagevisualizer/

Windows ListView control (or similar) that can have multiple columns of checkboxes?

OK, so my Windows application involves a window that, among other things, has a list of objects in a pane. Each object has 8 boolean values that need to be determined — so I'd like a list of the objects, with eight columns of checkboxes after. I'm not using MFC, should that be relevant.
ListView looks the way I want it to, but apparently it doesn't accept checkboxes in SubItems (the LVS_EX_CHECKBOXES style only gives each row a checkbox on the left).
So what I need is some kind of alternative to ListView that does allow this. I've been looking, but nothing I've found seems to work.
I have seen reference to some DataGridView control, but I don't see that as an option in my Visual Studio 2010 "toolbox" — how does one access it, is it even available for non-MFC C++ projects? Most references to it seem to be for VB or C#.
Another thing I found is is this custom ListView, but it, again, seems to be for C# and not C++. I'd certainly accept suggestions on how to use this resource in my code, if there's a simple way to interface with the C# dialogue (I'm completely unfamiliar with C#).
Anyway, any thoughts, suggestions, or tips anyone has, would be most appreciated!
EDIT: This should maybe go in a new question, but it doesn't really seem deserving an entire question on its own: MFC seems to have more support for this kind of thing (insofar as most of the custom controls I can find to download are for MFC). My project does not actually require being non-MFC, it just is, at the moment. How much work am I looking at to convert it?
Well, I've taken the plunge and started using MFC; the CGridCtrl I downloaded seems to be working pretty well, though I still have a lot of work on it. I'm going to call this the answer, then, since there doesn't seem to be another forthcoming.

Windows context menu for multiple files [C++]

I want to create a context menu that support multiple files.
I read through SO and understand that either you must use DDE or shell extension (something to do with creating and registering COM object). However all the sourcecodes I found are in C#.
I then decided to go with COM object. I found 1 in C++ that uses COM but it's dated 2006, so I just don't know if it's outdated. http://www.codeproject.com/KB/shell/shellextguide1.aspx
Can anyone shed me some light on this? And is there any good and new article out there covering this issue?
Or if anyone has some something similar before using DDE and IPC?
It should work fine, the underlying mechanic hasn't changed in the last 4 years.
Take a look at the comments at the bottom of the article, people are using it without problems. (There is also a link to a VS 2008 template for multiple-files)

Integrating Qt into legacy MFC applications

We currently maintain a suit of MFC applications that are fairly well designed, however the user interface is beginning to look tired and a lot of the code is in need quite a bit of refactoring to tidy up some duplication and/or performance problems. We make use of quite a few custom controls that handle all their own drawing (all written using MFC).
Recently I've been doing more research into Qt and the benefits it provides (cross-platform and supports what you might call a more "professional" looking framework for UI development).
My question is - what would be the best approach to perhaps moving to the Qt framework? Does Qt play nice with MFC? Would it be better to start porting some of our custom controls to Qt and gradually integrate more and more into our existing MFC apps? (is this possible?).
Any advice or previous experience is appreciated.
In my company, we are currently using Qt and are very happy with it.
I personnally never had to move a MFC-app into using the Qt framework, but here is something which might be of some interest for you :
Qt/MFC Migration Framework
Qt/MFC Migration Framework
It's part of Qt-Solutions, so this means you'll have to buy a Qt license along with a Qt-Solutions license. (edit: not any more)
I hope this helps !
(This doesn't really answer your specific questions but...)
I haven't personally used Qt, but it's not free for commercial Windows development.
Have you looked at wxWindows which is free? Nice article here. Just as an aside, if you wanted a single code base for all platforms, then you may have to migrate away from MFC - I am pretty sure (someone will correct if wrong) that MFC only targets Windows.
One other option would be to look at the Feature Pack update to MFC in SP1 of VS2008 - it includes access to new controls, including the Office style ribbon controls.
It's a tricky problem, and I suspect that the answer depends on how much time you have. You will get a much better result if you port your custom controls to Qt - if you use the QStyle classes to do the actual drawing then you'll end up with theme-able code right out of the box.
In general, my advice would be to bite the bullet and go the whole way at once. Sure, it might take longer, but the alternative is to spend an age trying to debug code that doesn't quite play ball, and end up writing more code to deal with minor incompatibilities between the two systems (been there, done that).
So, to summarise, my advice is to start a branch and rip out all your old MFC code and replace it with Qt. You'll get platform independence (almost) for free, and while it will take a while, you'll end up with a much nicer product at the end of it.
One final word of warning: make sure you take the time to understand the "Qt way of doing things" - in some cases it can be quite different to the MFC approach - the last thing you want to do is to end up with MFC-style Qt code.
I have lead a team doing this kind of thing before (not MFC to QT but the principles should work).
First we documented the dialogs and what their inputs, controls and outputs were. Also, we create several test cases especially for any clever logic inside the GUI.
Sometimes we had to refactor some business logic to provide a clean interface the GUIs but this is the way it should have been done in the first place tbh.
Now we had a list of GUIs, inputs, outputs, tests and an interface that the encapsulated GUI had to match.
We began, project by project, to create equivilant GUIs to the old ones. Once we did that we could slot the GUI in where the old one was, rebuild and test it. At first we tripped a lot but we soon worked out the common errors and fixed them. We navigated (I think) 612 dialogs although there was a team of about a dozen of us working on it.