Website screen capture from native application - c++

I have a native C++ application built using using OpenGL (and openFrameworks as well in some core classes). I have been looking for a way to programatically take the screenshot of a website from this desktop application that is to happen on some interaction by the user and save it in a certain path on the computer.
I am fine with installing a separate application to issue commands to it somehow, a command line program, including a small API or library etc. but I have to stick to Windows for this purpose.
I won't be able to include another full framework such as Qt for this purpose (which I believe gives the ability to take a screenshot from native application). I found some solutions for mac and linux but couldn't find anything for windows:
webkit2png : http://www.paulhammond.org/webkit2png/
khtml2png : http://khtml2png.sourceforge.net etc.

Related

C++, Code::Blocks, which project type should I choose for GUI in both windows and macos?

I'm trying to create a simple GUI program that stays on top and shows an image plus few buttons with variable opacity for the whole window to use like onion skin over other programs.
after installing Code::Blocks I'm facing lots of choices for the project type and I have no idea which one I should choice to be able to build for both windows and macOS platforms.
I'm trying to make it a single file program or contain everything in the same folder, without the need for anything to be installed, that's why I've chosen C++ after reading about other possible solutions, I'll appreciate any information about that topic as well.
On Windows you would normally use the Win32 GUI project option, which will use the WinAPI and thus only be compatible with Windows. If you want to support both Windows and MacOSX with the same code base you need to use a platform independent GUI framework such as QT or GTK+.

Is it possible to use Native C++ code in ARC?

We want to try to launch our software on Chrome OS using ARC. Many parts of our software application are written in C++ and compiled using the Android NDK.
Is it possible to launch this kind of application under ARC?
Is it possible to launch Native applications(or Java + JNI) under ARC?
Yes, ARM compiled NDK libraries will run on all Chromebooks currently. For ARM machines they run more or less natively.
For non-ARM machines there is a binary translation layer that dynamically converts the code to run on the target machine. This layer may not be 100% machine compatible and if you see errors or crashes indicating instructions cannot be translated, or fundamental differences between your app on ARM and x86, you should file a bug: http://goo.gl/megdlG
I am currently using a library in my project called PDFtron. It contains ".so" files that I have to assume are either c or c++, and they work fine with Java + JNI. There doesn't seems to be a lot of information out there about how this all works(and what works or doesn't), so please post your findings.
From google spokesperson(taken from arstechnica):
"""The app code is all running on top of the Chrome platform, specifically inside of Native Client. In this way the ARC (App Runtime for Chrome) apps run in the same environment as other apps you can download from the Chrome Web Store, even though they are written on top of standard Android APIs. The developers do not need to port or modify their code, though they often choose to improve it to work well with the Chromebook form factor (keyboard, touchpad, optional touchscreen, etc)."""
In this quote I think the important part is the integration with native client, which is a technology for executing Native code like C and C++ in the browser.

MFC app to Linux dll

Currently we have a legacy client/server system written in MFC(server) and Java(client). This system cant not run on Internet because of various reason. So, we are developing a small system (very few functionalities of this legacy system) in cake php etc to fullfill customer requirement.
Now, one functionality in legacy system needs in this new system. We are thinking of making a DLL of that code and then integrate it with cake php (to save time) but this DLL will not work on Linux where this new system will sit.
So, is there any way to generate a dll so that it works with php in Linux system using QT etc?
OR
we have to rewrite the whole thing? In this case, what would be the most appropriate framework to develop cross platform dll. I would prefer to use Windows to write it.
Also, can we run dll with cake php?
Thanks
So, is there any way to generate a dll so that it works with php in Linux system using QT etc?
No, Linux doesn't support the DLL file format. You may want to compile a shared object file in the ELF format from your source code.
I think, the two most prominent cross platform GUI libraries are wxWidgets and Qt.
You cannot use a Windows DLL as a part of a Linux application. That is simply not possible, because of the different object formats.
So, the only option is to rewrite or port it in some form.
A guide for porting your application might be Porting MFC applications to Linux, which uses wxWidgets.
Another one using Qt, could be MFC to Qt Migration - Walkthrough.

Launching URL - Cross Platform (C++)

I am not sure if this is possible, but I am trying to open a URL in the users default browser in C++. I would just use 'ShellExecute', but I am trying to make it cross platform. Anyone know any ways that this is possible, if it is?
By cross platform I mean the 3:
Linux
Windows
Mac
I've literally Google search for sooo long, and found nothing. Thanks for any help :)
Your best bet is to use a cross platform library like Qt or something like that. Qt has a nice class called QDesktopServices which you can use to do it:
QDesktopServices::openUrl(QUrl("http://google.com", QUrl::TolerantMode));
According to the documentation:
Opens the given url in the appropriate Web browser for the user's
desktop environment, and returns true if successful; otherwise returns
false.
Do note that this will add an dependency on Qt for all your platforms for what might be a very trivial task. It is best that you use custom code for each platform and set compiler directives to see which operating system you are on and run the browser launching code according to that.
Like, if it is being compiled on windows, you could just compile ShellExecute function, if it is being run on Linux, then depending on the desktop environment you could run the appropriate command.
But, if you are really making a cross platform application, a dependency like Qt would not be bad as it will help with a lot of cross-platform stuff (like keeping an icon in the system tray, multimedia playback etc.).
Without a library, there is no standard-C++ way to do it that will run on all platforms.

Using windows DLLs in a portable app

I have built a windows C++ application that I'd like to port to linux. The main reasons to do this is ease of system maintenance for our IT staff. Apart from the one windows machine that runs this application we're a linux only operation.
The reason this application was built in-, and runs on- windows is that it uses a windows API (dll and header) to connect to a server belonging to an external party. This connection uses some proprietary protocol that I don't really want to mess with, (and I think I'm contractually not allowed to) so I'm stuck with the .dll.
This dll is windows only because of (I suspect) windows sockets specific code in the dll. Apart from that it doesn't do a whole lot of advanced stuff. Is there a way somewhere between just running the app on linux in WINE and sniffing out the protocol and reimplementing the DLL myself that will allow me to get this application to run on a linux machine?
This idea got inspired by this item about QT creator so any solution that allows me to play with that would be extra cool.
The most obvious middle ground would be to use Winelib. I do not know if it can link directly to a native DLL, but if not you probably could load it with LoadLibrary().
You could then split your application in two parts: a wrapper which only calls the DLL, and the rest of the code talking to your wrapper. You could have both in separate processes, and thus only the wrapper would have to be compiled with Winelib. The rest of the application could then use whatever framework you want.