C/C++ strip chart - c++

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

Related

Popup Text Input Box in C++ with OpenGL

I am trying to create a simple popup box that appears when my C++ program starts that will allow the user to enter the width, height, and length of a cube that will then be displayed in a separate window. I have been searching for a very long time, and I have yet to find a solution that will allow me to do this. Can this be done using C++, OpenGL, and GLUT? Or do I need another library to allow me to do this.
Thank you.
Jordan
Edit: I am programming a cross-platform program and cannot use Win32 to accomplish this, nor any other Window-specific function.
What are you are looking for is a graphical user interface.
There are many libraries available that interface with various input methods (for keyboard and mouse) and provide graphical output. Each one has it's own model.
There are various models, but the most common one is hierarchical.
If you are looking for a learning experience, I suggest you do some Googling on how to make your own GUI.
If you are simply looking for a convenient library that does the hard-yards for you, I strongly recommended AntTweakBar:
AntTweakBar is a small and easy-to-use C/C++ library that allows programmers to quickly add a light and intuitive graphical user interface into graphic applications based on OpenGL, DirectX 9, DirectX 10 or DirectX 11 to interactively tweak parameters on-screen....AntTweakBar works with GNU/Linux, Windows and OSX
It was designed not as a monolithic batteries-included do-all library (such as Qt, another alternative), but as a simple and lightweight tweaking interface (hence the name).
There are several examples available and it's API is quite simple, so it should be reasonably easy to pick up.
There's also GWEN. It is not a well known library, but I find it extremely versatile and easy to use.
Facts- Coded in C++- Fully Namespaced- All standard window controls- Behaves like you'd expect- Lightweight (No XML readers, no font loaders/renderers, no texture loaders - your engine should be doing all this stuff!)- Easy to integrate (comes with renderers for Windows GDI, Allegro, OpenGL, DirectX and SFML)- Totally portable & cross platform- Doesn't need RTTI- Released under a "do whatever you want" MIT license.
Opinionated note: I prefer GLFW over GLUT. It provides a nicer model, and is still in active development (unlike GLUT which has not been updated in a significantly long time). At least use freeGLUT
You need to use another external gui library to do it. If you're doing it for windows, MFC is a good option. Or check library OpenGL User Interface Library.It's cross platform.
Here some libraries
Maybe this link helps you
Your statement saying that you wish to have a popup box implies your wish to use the underlying windowing system, regardless of the OS.
If you want to be cross-platform, there are quite a few libraries you can use that either emulate or actually use the underlying windowing system, such as wxWidgets.
If using such a library is not an option, you can always use the OpenGL window to draw text and emulate your popup yourself, but that's a bit more work, imo.

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.

Stock Charts in C++

I am trying to create some charts of data (eg http://www.amibroker.com/). Is there a C++ library that can do this without a lot of extra work? I'm thinking Qt or wxWindows would have something like it, but it wasn't immediately obvious.
Thanks!
FLTK is a light and portable C++ toolkit for GUI. There's a chart class. Sample.
Qwt does at least some of the things you are trying to achieve (basic plots, bar charts and so on), and integrates well with Qt.
I think you need to pick your GUI framework first, then find a charting control for the given framework, since that affects what charting controls you could feasibly use. For example, must this be portable?
For the project I'm working on (a large MFC application) we use Cedric Moonen's ChartCtrl. We've had a pretty good experience with it so far.
I've done some graph plotting with gnuplot lately, which is quite powerful. Although I think it is Linux only, which may or may not be a problem.
Also, believe it or not, some amazing things can be done with LaTeX. I've used the tkz (tikz) library to produce some awesome graphs.
Both solutions plot to a file which you can include in your interface.
They aren't C++ libraries but you can easily create the datafiles and call the necessary programs from within your C++ program (Being creative with system() and possible some shell scripts).

searching for winapi functions

I'm learning programing windows applications with C++. Now I'm reading about messages and I'm playing with the spy++.
What function spy++ use in order to mark/highlight the window under mouse cursor?
Also, can you give me some tips about using MSDN? I'm my opinion is not user friendly at all.
I'm learning programming by myself and i can't get some real life experience tips as those which are learning at college or in teams.
ty
Not sure exactly what your problem with MSDN is ... I tend to go to e.g. Win32 and COM development and look around for a suitable category in the listing to the left, then click down from there. Or just enter function names and search if I already know what I'm looking for but want the reference documentation. On the other hand, I'm not much of a Win32 developer.
I think spy++ is just inverting the colors directly on the window/screen DC (You could use InvertRect() for example) On Windows 2000 and later, it is probably better to use a translucent layered window if you actually wanted to implement this window highlight since some graphic corruption can occur when messing with other windows behind their back.
Writing a Windows application with just the windows API is possible, but you'll end up writing huge amounts of boilerplate code just to create simple things. This is why people normally use libraries built on top of it to make things easier - MFC for example.
The MSDN article Creating Win32 Applications provides a good explanation of the ins-and-outs of a Windows application using the Win32 API. Bare in mind though that you could build the same application in minutes using MFC.
I agree that MSDN is not the most user friendly source of information for a beginner. In my opinion it works much better as a reference.
My advice would be to focus on building some test applications using MFC (assuming you are tied to C++ as a language). Try looking at the codeproject MFC sections for example, and perhaps even buy a book to help get you started. This does of course require Visual Studio, but you can download the free express edition here

Need a client-side interactive 2D world map: best map package? Or best C++ graphics/canvas library to make one?

I need a 2d political map of the world on which I will draw icons, text, and lines that move around. Users will interact with the map, placing and moving the icons, and they will zoom in and out of the map.
The Google Maps interface isn't very far from what I need, but this is NOT web related; it's a Windows MFC application and I want to talk to a C++ API for a map that lives in the application, not a web interface. Ideally I don't want a separate server, either, and any server MUST run locally (not on the Internet). What canned map package or graphics library should I use to do this? I have no graphics programming experience.
This is strictly 2D, so I don't think something like Google Earth or WorldWind would be appropriate. Good vector graphics support would be cool, and easy drawing of bitmaps is important.
All the canned options seem web oriented. SDL is about all I know of for flexible canvas programming, but it seems like making my own map would be a lot of work for what is probably a common problem. Is there anything higher level? Maybe there's a way to interact with an adobe Flash object? I'm fairly clueless.
Perhaps:
http://www.codeplex.com/SharpMap
ESRI MapObjects
http://www.esri.com/software/mapobjects/index.html
ESRI MapObjects LT
http://www.esri.com/software/mapobjectslt/index.html
See
http://www.esri.com/software/mapobjectslt/about/mo_vs_lt.html
for a comparison of the two MapObjects feature sets.
ESRI may have a replacement to the MapObjects libraries
You could extend your search by using the term GIS (Geographic Information System). I'm sure its gonna be easier. There's a lot of stuff out there on that subject.
Here's a page I found: http://www.ucancode.net/Gis-Source-Code.htm
or: http://opensourcegis.org/
You might want to try the Mapnik C++/Python GIS Toolkit.
You can take a look at the Marble Widget, which is part of KDE's Marble project. There are Windows binaries for this, too, but they might be dependent on Qt.
Yes, Marble has also the advantage that it provides kind of a ready made solution in a single control (called "widget" in Qt's technical terms).
The dependency on Qt (which is the only dependency btw.) might also be seen as an advantage: Qt's upcoming version is licensed under the LGPL, so even if you plan to use this in a proprietary application then there shouldn't be any real worries. And of course Qt and Marble are cross-plattform and provide an API that is very intuitive and easy to understand. Unlike common GIS solutions the Marble API and the usage of the widget is rather focused on people who don't know much about GIS. So its usage is quite easy to understand even if you feel scared by technical terms used in GIS.
Marble offers several interfaces to programming:
You can either create your own Marble plugins and paint inside those or you can subclass the MarbleWidget control. For a simple HelloWorld application see:
http://techbase.kde.org/Projects/Marble/MarbleCPlusPlus