Excel files and C++ - c++

How i can read\export data within a C++ application to Excel files? I was found the xlslib project, but it only compiles with MingW on Windows. My target platform is windows (MVS2008)

You can try this commercial library http://www.libxl.com, it works with Visual Studio 2008 and doesn't require Microsoft Excel.

If you're stuck with unmanaged C++ and need to communicate directly with Excel you'll need the COM automation interfaces. See the MSDN article link text
If you want the expressive power of the new managed interop, I think you may need to wrap your C++ code in an interop dll.

On windows, you can also give a try to ExcelFormat lib.
http://www.codeproject.com/Articles/42504/ExcelFormat-Library
It doesn't require Excel installed, and it's very easy to use.

Related

How do I add Mysql.data.dll into uwp with c++?

I have been to try to use Mysql with c++ in UWP for 2 days...but I could not do so.
I already installed Mysql.data and Mysql.ConnectorNet.Data through Nuget.
However when I tried to use Mysql obejct, I couldn't find anything. Intelligence does not work too so I tried to add Mysql.data.dll directly, but I couldn't do too. I just got a error message. It said that "could not add a reference to "my path" as it is not of a type or version current proejct can use."
Does anyone know how to solve it?
Mysql doesn't provide a dll which can be directly used by C++/CX in its official site. The dll you mentioned "Mysql.data.dll" is actually a Dll for winrt .net which can not be directly used in C++/CX.
See MSDN docs:How to: Use Existing C++ Code in a Universal Windows Platform App
You will find this:"Do not add a reference in the References node in Solution Explorer. That mechanism only works for Windows Runtime Components."
So actually you can test by create a new simple Windows Runtime Component to see what it is.
Possible ways to start are
Read the above msdn doc and use native C++ mysql library which is located under C:\Program Files\MySQL\MySQL Connector C++ 1.1.9\lib\opt(After installed the native C++ Connector you can find it). ( I haven't worked out when using static library yet.)
Or Directly use the code from it's github to create a C++ winrt version dll.
As this may need lots of time when investigating I think it's better for you to think about using some exist database technology. Like UWP suggested sqlite database.

Developing an Excel XLL using Mac OS X / Linux

I've been developing C++ models using Visual Studio for the past 5 years, and wrapped them into Xll to be used with Excel (using xlw). The Excel add-in is the final product I want to deliver.
However, I believe C++ coding is way better using Linux or Mac OS X. But I also believe using my models with Excel through the Xll is also very practical, but sadly only works on Windows.
So I would like to know if there is a way to do the implementation on Mac OS X (or Linux), generate the Excel add-in and use it on Windows.
The only method to do so that I'm currently thinking of is doing the coding on Mac OS X, compile the project without including the part concerning the Xll, then load the project into Visual Studio and compile it entirely to generate the Excel add-in. But to be honest, this sounds a bit laborious, and I'm hoping for an easier way.
It is possible. You just need to use mingw (http://mingw-w64.sourceforge.net/) to compile from Linux. I should note that you can then use g++ 4.7, which is a very decent C++ compiler with support for C++ 11x. The cross-compilers work both in Mac and Linux, and because it is gcc, you can use them with your favorite tool ecosystem.
There are few unexpected quirks, but just in case:
Remember to use -Wl,--add-stdcall-alias to get functions exported with no underscore in the final dll.
Instead of declspec(__declexport) use __attribute((dllexport)). But you can also use the more antique .def trickery, if you wish. In any case, use the Windows sdk tools "Depends.exe" or similar to ensure that your dll exports correctly the names.
If your are using a virtual machine for testing, or any fresh Excel installation, remember to install all the bells and whistles that come with Office and Excel. Otherwise, in Excel 2007 and Excel 2010, the addins won't work, and you will mistakenly blame your build setup.
Also, if you are up for using http://kalx.net/xll/, which indeed can make your life simpler, you will have to update that library for strict C++ conformance.
Best regards.
I've developed a working example of a C++ Excel addin using Mac OSX, Eclipse CDT and XCode and a spreadsheet that uses the addin. An explanation is here http://www.smr.co.uk/excel-addin-on-mac-os-x-using-cdt/ including versions used etc and the code is here https://github.com/PollardsEtFilles/MacCPPExcelAddinExample.
There are two gotchas
Excel 2011 is 32 bit
Make sure the addin in the same directory as the excel spreadsheet
clang (included with Xcode) is a good replacement for g++
All you need to do is install Eclipse CDT and import the code you'll be away.

Best way to create a standalone-exe (Forms) (C++)

I have to create an application for testing that is relatively simple. If a user plugs in a device into a USB (hid library), the form will say "Pass". If no device is detected, it will say "Fail".
I want to create the app to run on WinXP+. It must be a forms application as it needs to be visual and have colors. The biggest requirement for me is that it must be stand-alone (a user just double clicks, the file and it opens, no installation). I need to avoid installing any extra .dll files and want to avoid the .net framework all together. It has to be written in C++.
So my question is, what are my options? I am new to Forms applications and the only forms application I have written required the .net framework.
From my research, Visual C++ seems out of the question as it requires .net for Forms apps. What about Turbo C++ by Borland? It seems outdated, but can it do the job?
I would suggest Borland C++ Builder 5 or 6. Visual C++ lacks the functionality to create C++ form apps, if we dismiss MFC
I'd say Visual C++ would probably still be your best option. A standard simple Win32 C/C++ program using only the native API will should suite your needs just fine. If you're targeting XP+, then the only dependency would be "msvcrt.dll" which is included with Windows by default.
Edit: This article on MSDN should get you started in the right direction.
What you're talking about is C++/CLI, it's microsoft's dialect of C++ that requires a .Net framework. Please distinguish it from real (native) C++, which can be used to create what you want to. Visual C++ is perfectly fine, just make sure you don't create a .Net project.
Forms are a .NET library. It's not Windows or anything like that, you can use the native GUI libraries in Win32 with no problem or any native wrapping of them. You can implement this in native C++ easily in Visual Studio.
If you're looking to create the application in a rapid fashion (i.e. stock UI components that you can drag and drop onto forms), my experience is that Embarcardero C++ Builder effectively solves that problem space.
I like Visual C++ but it's not a great environment for rapidly creating forms based applications. I want to emphasize that I'm referring to Rapid Application Development (RAD) tools. There are plenty of great C++ IDEs and libraries for creating forms based applications and all of them should be able to create standalone exes.
Here is a list of related questions that might help in your decision:
https://stackoverflow.com/q/1754020/4916
https://stackoverflow.com/q/93326/4916
Best C++ IDE or Editor for Windows

VSTSDK and Visual Studio Express 2010

I am new to C++ and Visual Studio and have two questions:
Where do I need to put the VSTSDK so that VS recognizes it and I can use it in my projects?
Does anybody have some sample code for a VST host?
It doesn't matter where you put the VST SDK, as long as you tell Visual Studio. In Visual Studio, you can add any library and #include path, and that's what you'll need from the SDK.
I would also recommend checking out the Audacity Source Code for a VST hosting example. There used to be a great vsthost.cpp example on the web, too, but I can't seem to find it. =/
There are some few examples like, vsthost, vstboard, audacity.
vsthost is using asio only, the 2 others are using portaudio and portmidi.
vstboard is using Qt for gui, audacity uses wxwidget.
The problem is : what kind of host do you need (simple for one plug in ora complex one) Also, you should take a look at JUCE library which offers good features for all of that even if I would prefer the vstboard design (Qt + portaudio)
good luck

C++ open window hello world

How can you write a C++ program to open a window like this one...
Is it possible or can apps only be ran from the command line?
I'm using the G++ compiler... Do I need something else like visual studio?
Can I do it just by writing code?
Take a look at Qt which is a cross-platform framework that easily builds GUIs.
Then check out a Qt tutorial, do a google search. Here is one that will get you to "hello world"
Also, you might want to check out Code::Blocks as an IDE. It will use your already installed g++ compiler.
You can use Borland C++, Visual C++ they has GUI or wxWindow or GTK library.
GUI programming requires the use of additional libraries. There is a C++ GUI library supplied by Microsoft for Windows called MFC. There are many other GUI libraries out there.
If you use these GUI libraries, you don't need to run the application from the command line.
Search for WinApi Tutorials like this one
there are alot
or you can also you the Visual Studio MFC application wizard and create a dialog application
Microsoft provides a tuturial for doing that:
http://msdn.microsoft.com/en-us/library/bb384843.aspx
The best and most low-level way of doing this would be by using the Windows API:
https://learn.microsoft.com/en-us/windows/win32/learnwin32/learn-to-program-for-windows
Microsoft itself provides excellent tutorials and documentation on how to program with their Windows Application Programming Interface, but there are also numerous other tutorials out there that can be found quickly with a google search.
To create a window like the one you ask about in the question, you would be looking for the following link:
https://learn.microsoft.com/en-us/windows/win32/learnwin32/your-first-windows-program
It might seem daunting at first, but the Windows API is extensive and provides a huge amount of functionality, on top of just creating GUIs. It would probably be worthwhile familiarising yourself with it if you are interested in Windows programming.
You need to use the Windows api from within C++.