I'm trying to figure out some C++ programing and OO concepts.
What I want is i want to have a core exe which scans a folder for dll's then loads it's start function and launches the plugin. This has already been developed and is running fine.
I'm in a position right now I've never been before and I'm new to C++ and winapi programming.
What I want to do is just drop a dll in the plugin folder, and the core add's the functionality.
This is working right now, but the plugins are running like separated exe's. Now I want to communicate between plugins if they are available.
I tried setting up the dll as a object factory, but then I'm here with this object inside of my code expecting the dll to be there.
Does anybody know any good design patterns I could use without just trial and error, and some reinvention of the wheel? Google isn't showing me what I search for and I'm too new to this to know any good knowledgebases.
Related
I would like to interact with an opened qt window (wrote in c++) using code. The code would act like a user and will be completely independent of the code of the qt window. Something like web scraping but with qt (which is much more complicated).The first thing I’m attempting to do is to mimic a click on a push button.
My first intuition was to add some c++ code to the existing code at runtime and execute something like « pushButton.click(); ». After some few searches I tried to use dynamic shared library. The library would implement the code of the button I want to click on, and would be dynamically added to the existing c++ code. This solution could work but seems to be very complicate and not portable. Furthermore I would like the solution to be very independent of the window code.
Of course the qt code of the window will be accessible from the scraping code side.
Are some other solutions more practical ?
EDIT:
GammaRay seems to work fine. I manage to perform a click on a pushButton using the GUI. However, GammaRay doesn't seem to provide a command line interface form. As we can read in the official documentation:
The GammaRay client is available in two forms:
as a standalone application as depicted in the following screenshot
as Qt Creator plugin (for Qt Automotive Suite only)
Is there any possibility to perform a click using GammaRay and without GUI? Are some other solutions work using code only?
The purpose of GammaRay is introspection and not automation. I recommend to use Squish (https://www.froglogic.com/de/squish/editions/qt-gui-test-automation/), depending on the required licenses the price is not so high.
If you don't want to spent the money, then you have to create your own IPC Interface with Remote Commands.
The problem
I would like to use c++ to create an application that uses the new macbook pro touch bar. However I am not able to find any really good resources. And apple does not have any docs on using c++ to program the touch bar.
What I have done
I found this article on c++ and the touch bar, However I cannot find either of the header files for the script GLFW/glfw3.h and GLFW/glfw3native.h. These both seem critical to the script working.
More on the issue
Even if the above article's script works, there are no official docs for programing the touch bar with c++ (That I know of). I think that this is an important thing to have given the fact that many, if not most applications are written in c/c++.
Thank you in advance for the help!
So the article that you link to basically does not need the GLFW/glfw3.h and GLFW/glfw3native.h files if you are not using GLFW.
What UI framework are you using for your C++ app?
Unless it is still using Carbon, at the lowest level, the framework will be creating NSWindows to actually have windows in the UI. You need to get access to the NSWindow that your framework is using to host it the UI. If it is still using Carbon, I think you are probably not going to be able to accomplish this.
If the framework provides some mechanism to get the native platform window (which will be an NSWindow), you would replace the author's call to glfwGetCocoaWindow(window); with the correct call from your framework.
If the framework does not provide access to the NSWindow, then you will need to use the code that is commented out at the bottom of the article to attach your touchbar to the windows in your app.
Please note that all that code is Obj-C code; you'll need to have at least one .m or .mm file in your project to provide that Obj-C glue code to get access to the touchbar. Basically that code is a C-calleable wrapper around the Cocoa API.
Also note that you'll need to expand the list of buttons and actions for all the different things you want to put in the touchbar. You could add your own wrapping API so that the construction of the toolbar is done from C++ and registers actions that call-back into your C++ app to handle the events.
Fundamentally though, the touchbar is not available on any other platform, so there is no great benefit to trying to avoid writing Obj-C to implement your touchbar as that code will only run on macOS anyway. If you use .mm files to implement Obj-C++ for this code, you can still call into your C++ objects from your touchbar code.
I have a sample code I'm using to watch for USB events using the FTDI D2XX library. The sample is C++ code, and uses MFC which I've never touched before. I'm trying to get this executable where I can make it into a .dll (which is a whole other can of worms), but without it having a main function because of MFC, I'm not sure how I can add functionality to this existing sample code (I just need to add one function). This is the most complex project I've dealt with, and it's new to me so any suggestions would be appreciated.
Example 7 here:
http://www.ftdichip.com/Support/SoftwareExamples/CodeExamples/VC.htm
I have developed communication program with c++ console programming, it is complete and works fine. Now I need to change my code for some real-time purpose, where I need to use the previous and add further and generate the .avi movie (most probably with BMP images).
The thing is the that as I have understood that the movie can only be generated with win32 c++ and not console programming?
hence
1. Can I use the same code (with necessary changes ofcourse) and the APIs that I was using in console programming with the win32 programming?
Can I go the other way around, i.e. make the movie generation code in win32 c++ and later include somehow in the console program. If yes, any idea?
any other idea is also appreciable
There's no difference to Win32 programming and "console" programming - you can use both at the same time. The only difference is the main entry function you're using (most often main vs. WinMain). So, don't bother setting up a new project if the console app could be adjusted more easily.
In fact, console apps can even make windows, and a window-based app can create it's own consoles as well. And there's no difference to Win32 C++ and console C++ (apart from the main entry function you're using I've mentioned and the idiomatic way to communicate input and output).
What I am trying to do is create an exe (not .hta) that can be programmed to open a local html file and have it work just like it was in IE (handle styles, scripts and etc), only without actually loading IE. The exe must also be run without installation requirements, and no dependencies (other than recent IE obviously), needed on the host machine.
The purpose is to create an interactive e-book type document, that can be edited without recompile, and also be run from cd/usb on the fly.
I can't just open IE, because it will look unprofessional with the big E, the toolbar and tabs all at the top. know what I mean?
I have experience with HTA, and this was my first suggestion, however I would like to take advantage of the auto run from cd, and also to make the form border a little different, less plain.
I also have experience in VB. Which I could accomplish the look and functionality, however those vbruntimes are not installed on some machines :(
Is it possible to use the IE webBrowser control from c++ or even assembly?
Thanks in advance!
It appears, Lucian Wischik's Webform can be a good starting point to meet your minimalistic project requirements. Alternatively, you could host WebBrowser ActiveX control directly using ATL AxHost. ATL can be linked statically and adds a very low size overhead to the final EXE. Here is a sample project of WebBrowser host app which only depends on ATL.
Yes, you can use the browser component from C++.
C++ however will again need runtime libraries, similar to VB. The good news is, you can statically link those runtime libraries with the executable.
You will not be able to statically link the browser component with your executable, but that wont be an issue unless you try to support ancient Windows versions (pre NT 4.0). For all more recent Windows versions, you can pretty much assume that this component is available.
For more details on that component, you may refer to the CHtmlView class reference - that is the MFC wrapped version of that WebBrowser activeX component.
Using that component from assembler certainly is possible as well, but unless you are deeeeeeep into system programming on the windows platform, you will fail.