Debugger visualizer of GDI objects for unmanaged C++ - 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/

Related

How do you open a windows application as a source for OpenCV?

I would like to recognize objects of windows applications, mainly computer games. I would like to accomplish this by opening the window in OpenCV and applying all kinds of effects to the game application under execution and recognize objects such as UI elements, messages and even characters that are on the screen.
Since OpenCV only allows video and webcam as input, is there a way to open a running application as a source for OpenCV?
There maybe some testing applications used in game development that use similar methods for testing, but I couldn't find any.
I also don't know the right terms that that are used when discussing the recognition of virtual objects of a computer program or computer game, but that is exactly what I would like to do.
I tried to look up forums, articles or anything written about this, but found nothing. Any help would be appreciated.
I used OpenCV for a year and I am not sure if you can pass the running application to it.
As an alternative, you might like to have a function which gives you the current screenshot of the desktop. So you can get it and pass to OpenCV.
This way you can periodically do screenshots and use your recognition.
If you are working under Windows you might need this discussion.
Hope this will somehow help you.
I've been trying all method using desktop as source in opencv few months ago as my experiment project and i success, but there's a trail inside the windows, as maybe the speed or processor depends on it. It using your own function to use desktop as source not from opencv libraries. And from there i continued custom things and got stuck in some bug that has something from memory, as it use lots of memory. I did post on stackoverflow. Hope this information helps.

Debugging unmanaged C++ images in Visual Studio

I do write lots of image processing code with lots of different images involved on unmanaged C++ under Visual Studio 2010. I want to be able to watch them almost as easily, as a simple identifier while step-by-step debugging.
My current solution is to use some function which exports image in Matlab console. It is ok, but requires modification to source code, while I want to do it just while debugging. So the best option is just image popping up while hovering containing variable by mouse. But writing some command ExportToMatlab(image) in Command Window is enough. I don't know how to do even this, however.
There is the very similar question "Debugging image rendering in Visual C++, any helpful add-ins?", but it is too old and I found no acceptable answers in that discussion. Some tools are .NET-based (see image below), some requires additional code to be written (that's what I currently am using), and some projects are frozen or unfinished.
I can spend some time on implementing appropriate solution, so links to some good guides on how to customize debugger visualizer in VS are welcome too.
Update
I've created a Visual Studio extension based on Expression Evaluator Add-In. It is available to download from its SourceForge project page, called NativeViewer. Check for description on how to use it.
I can't actually believe that nobody suggested Image Watch yet. It's the most amazing add-in ever. It shows you a view with all your Mat variables (images (gray and color), matrices) while debugging, there's useful stuff like zooming or contrast-stretching and you can even apply more complex functions directly in the plugin in real-time. It makes debugging of any kind of image operations a breeze and it's immensely helpful if you do calculations and linear algebra stuff with your cv::Mat matrices.
Just for history: I've implemented my own solution based on Expression Evaluator Add-In. It doesn't fit well enough, but I was able to implement all what I needed.
Update
I've created a publicly available Visual Studio extension. It is available to download from its SourceForge project page, called NativeViewer. Check for description on how to use it.

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.

CMFCToolTipCtrl or CTooltipManager examples?

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.

C/C++ strip chart

Just a quick question.
I'm looking for a simple strip chart (aka. graphing) control similar to the windows task manager 'Performance' view. And have found a few, but they all rely on MFC or .NET :(
Am hoping that someone here might have or know where to get a simple strip chart Win32 control that is not MFC.
Thanks.
If you have to go the roll-your-own route look at the polyline GDI call. That can draw the entire line for you in one call.
I work on a system that draws charts with custom code (no 3rd party controls, all win32 GDI). It sounds really hard, but it isn't that bad.
A little math to map the points from your coordinate space to the device context, drawing gridlines/backgrounds, and Ployline. Done! ;)
Heck you can use GDI mapping modes to make the math easy (but I wouldn't).
If you have found a good MFC control, maybe your best approach would be to convert the code yourself to pure Win32 - MFC is a thin wrapper around the Win32 API after all. Out of interest, what is the name of the MFC control you found?
Few months ago I have also experienced the same issue: trying to find an existing implementation of a performance monitoring library, which looks similar to windows task manager. However because I couldn't find any existing library that works on multi-platforms (not dependent to MFC or .NET), to I decided to create my own library :-)
Today I just released the beta version of this library, and made it available as an open source project.
Check this out here: http://code.google.com/p/qw-performance-monitoring/
Let me know if this is useful. I am still doing some testing, to make sure that every features in this library work in Mac, Linux, and Windows. Once I am done with the testing, I will release the stable release. For the current time, enjoy using this beta version :-)
I don't think there is a standard one in the Win32 common controls library. You'll either have to use someone else's widget library, or roll your own using GDI to draw the graphs. It probably isn't too difficult to roll your own - just create a bitmap control, and set the image every time your data updates to a graph that you draw in memory.
Look at this amazing open source library: http://mctrl.sourceforge.net