What API/SDK to use for this Windows Application? - c++

I'm going to create a utility with GUI that will run on Windows operating systems.
It should require minimum (or zero!) amount of additional libraries, files or DLLs to run because it will be executed from an installer. Because of this, i don't want to use .NET for it will require user to install .NET Framework. I know today, most of Windows installed system come with .NET Framework but in my case i cannot be sure.
The utility will...
send some data to a web site and
parse the returning data,
collect some hardware info, like MAC address,
CPU type and make, hard-disk serial
number
I suppose native Win32 API could be used for all of those above, but instead of hassling with Win32, i'd prefer using a more developer friendly API, or SDK.
Thanks in advance.

Win32 API is the only way, and of course there are standard API - for sending data over the internet, you could use WinInet.lib/dll, to obtain information about the MAC, you could use the GetAdaptersInfo by using Iphlpapi.lib/dll,(here's a link on how to use it) for the Hard disk serial number you could use GetVolumeInformation by using kernel32.lib/dll. For the CPU Id, you might look into GetSystemInfomation
Edit: There's a C++ code, but you can easily derive a wrapper from this site Unfortunately, with WinAPI is not easy, no such thing as RAD with WinAPI but what you gain out of it is lightweight code instead of relying on SDK's, frameworks and dragging buggy dll's around with your application.
Hope this helps,
Best regards,
Tom.

You can statically link most C++ GUI libraries - even MFC. Personally, I recommend WTL, wihich is very light and header-only.

If what you want is minimum dependency with external files or DLLs you could statically compile all the required DLLs with the tool exe. Then you could use something like Visual C++ to develop such tool.

WTL is perfect for this sort of application and I am surprised more people aren't recommending it. You can also statically link with the CRT and hey presto - no dependencies and a very small EXE.

Delphi (now by Embarcadero) would do the job, creating a .exe file with no dependencies, and it is much easier to work with than the raw Win32 API.
If you don't like Object Pascal, you could try C++ Builder instead.

For the GUI you can either build your application with MFC (statically linked) or use a HTML based dialog that you can interact with using COM. (It is even possible to interact with javascript present in the page displayed by the dialog).

For the specific requirement that you do have, I feel Win32 API is the only way out.

Use MFC and statically link to it. No runtime dependancies need to be installed.

Related

Loading Qt libs(different versions) inside an application

We have our application developed in Qt 5.4 which is shipped as an SDK (dylib) for integration with other applications. All the dependent libs are shipped along with the SDK(Qt 5.4.x binaries).
However we bumped into an issue when the customer tried to integrate our SDK in his application. That application is making use of a component which has a Qt 5.3.x dependency. Our SDK has not worked with the application. The issue is due to the fact the "libqcocoa" in platforms is shared, which is leading to a crash.
Can an application be able to load two different Qt binaries(with/without namespace) ? If yes, how this can safely taken care ? (application is in Mac)
I also need to address the point that, the components which are using different Qt versions can be updated independently. What are the best practices generally followed ? Please suggest.
Your use of Qt is usually an implementation detail. Hide it by using private frameworks or linking Qt statically.
Alternatively, if you need to interoperate with the user's Qt, add a small open-source interface that forwards relevant Qt APIs to your code. You'll be surprised at how little Qt most code uses. The interface is likely going to be a couple thousand lines at most and you can machine-generate it.

Using a UWP library in a C++ console app

I understand that this isn't a really common use case, but my team has built a C++ UWP static library and I'd like to link it into an existing C++ console app. However, I can't find anywhere that says that this is possible, or even anyone that's asked this question. If I try naively adding a reference, it just says that "the two platforms are incompatible" (I'd imagine one is targeting UWP and the other just targets Windows).
Does anyone know if this is possible? Would save me a pretty big rewrite.
Thanks!
If your library is not portable is not possible.
If you have access code to the code of the UWP library try to port al the code to portable library and try it again.
Best Regards

How to deploy a portable C++ application?

I have written a portable C++ application using Qt libraries. This means that I cannot use the MT flag for compiling without risking memory issues.
This leaves me with two options:
1) Deploy the portable application with an installer.
2) Package the C++ dependencies within the same folder or use private assemblies.
Both 1 and 2 defeat the idea of portable software, so I was thinking of a third option:
3) Use IExpress to drop the C++ dependencies before launching the application. On exit, delete the C++ dependencies.
Unfortunately, option 3 has received some flak from some stackoverflow members. They even dislike option 2 which leaves me with only option 1. I can see option 1 as doable if I use a portable installer.
Is there such thing as a portable installer? Essentially, I want the installer to check to see if the needed dependencies are installed before running my application (just like a regular installer would) and if they are, then just continue running my application. Otherwise, give a message box to the user that they could download it providing a link to the URL. I am aware I can write my own installer that can do this in C++ but I was wondering if there are any installers that already offer this specific functionality.
http://qt-project.org/doc/qt-4.8/deployment.html
The dlls for Qt in windows are so small, that deploying them with the application isn't an issue in my opinion.
There aren't any programs out there that I know of that place the Qt dlls on windows in some place that another program later would find (like c:/Windows/system32).
I think the only place where you could expect reuse of the libraries is in Linux or a mobile device that has a lot of Qt apps. But even then you have make sure that the versions of the libraries are high enough to support all the functionality that you are using.
Hope that helps.

C++ Reads/Writes XML without CLR

I know this is a very stupid question and I'm very new to C++.
I'm developing Starcraft AI, it is DLL file. I'm trying to use XML to gather some data to the bot, however whenever I build the DLL with /clr option. The bot doesn't load properly. So, my question is what is CLR and is there a way to read/write XML without using /clr build option.
Thanks so much.
The /clr compiler option enables the
use of Managed Extensions for C++ and
creates an output file that will
require the .NET Framework common
language runtime at run time.
(from MSDN)
Starcraft is probably not developed under CLR (.NET Framework runtime).
I've used the free tinyxml library from C++ code - it was quick to get running and reasonably efficient. Well, about as efficient as it's possible for XML to be, anyway.
Starcraft probably won't run .NET binaries. You would have to either write your own XML parser, which probably isn't for you seeing as you are new to C++, or find a C++ library that can do it for you.
Example of one:
http://sourceforge.net/projects/tinyxml/

Where can I find a flexible logging library for Windows Mobile?

Can anyone suggest any open and free library for logging on Windows Mobile application written in C++?
It would be nice if it supports logging to files, syslog (would be nice) and logging level.
None that I know of.
You will most likely have to look for source code available logging libraries. Windows Mobile will pretty much compile most win32 code with no or little changes, so any win32 logging library should work.
Generally I build my own as I like fine gained control over my logging code.
Perhaps you could see if the logging from http://pt-framework.sourceforge.net/ fits your needs. I don't know if syslog is supported.
I'm currently using log4net in one of my compact framework projects. It's probably not ideal for production though, as the dll is 220k!