Hello fellow programmers, I come back to you to ask for a quick way to do something with MFC applications.
I have two MFC applications, and I want one to launch the other in a separate thread, so I can have both services running from executing a single exe file.
I'm actually new to MFC so I don't actually know what options I do have. Tried some dirty things but I keep getting duplicated resources problem, not to mention both apps start with BOOL CMainApp::InitInstance() and I'm guessing there is no way to have two initialization instances.
That being said, is there any quick way to rewrite one of the apps to become a secondary dialog without causing too much headache?
Thank you in advance, and excuse me if I'm asking something weird or easy.
It depends on what kind of MFC applications are they? MDI, SDI, Dialog-based?
Here are some options:
If the secondary app is Dialog-based, the conversion is pretty simple: you need to move implementation files for that dialog into the first app and merge the resources.
If both applications are MDI - you can merge their Document Templates so that the first app will be able to operate on all document/view types.
Otherwise - did you consider simply spawning the second app via CreateProcess()? What is the significance of them being run from "a single exe file"?
Related
I recently started using Xamarin.Forms for a project. Like the documentation mentions, it's great for prototyping. However, I'm really starting to notice limitations of the shared concepts for UI design. In particular, the inability to set custom button content (such as an image) is aggravating. I'm sure there will be several instances where I'll want to change how controls work.
The way I see it, there are two routes I could take. One, continue using Xamarin.Forms and make use of custom renderers. Considering I would still like my UI code to be shared, but also customized from the basic Xamarin.Forms controls, I'm leaning towards this option. Two, use the native Xamarin projects (Xamarin.iOS, Xamarin.Android). This would give me full control over the UI for each platform, but it would also mean more code to maintain.
Like I mentioned, I'm currently favoring the option to use custom renderers with Xamarin.Forms. Could I get some insight from those who have used one or (preferably) both options?
I've mainly used Xamarin.Forms. For the right kinds of apps (ones that are, well, "Forms"-like), it works pretty well.
Writing custom renderers isn't that hard, but the documentation is, unfortunately, not that great. Depending on what you're doing, it can be a bit tricky at times translating between the native control and the Forms layout engine. However once you get the hang of it, it makes sense, and now that the code is open source, you can peek inside to see how the "built-in" controls work.
There are various extensions that add more controls. Some are free and open source, like XLabs.Forms. So the control you need might be out there already.
You can use mechanisms like TapGestureRecognizer to turn an Image or a Label into a button, so just because the built-in Forms Button is really, really lacking in customizability, you can sometimes find other ways to get the same effect and still stay within pure Xamarin.Forms.
Hope that helps!
XamarinForms is good for sample application who don't need to use a lot of specificity of the device.
For complex applications, I advise you to start on Xamarin Ios and Android.
It will take more time to take charge but you will see it is much more permissive
We have this application written in Visual Basic (Windows Form Application) and I am tasked to convert it to Universal App (UWP). the said application uses a dll that is specific to .Net Framework so in order to convert it into a Universal App, I need to have a dll that is targeting .Net Core.
Is there a way to do it?
I know nothing in dll stuffs, can someone enlighten me up? Any help will be appreciated.
Your best bet in this case is the Desktop App Converter.
In summary, what that does is takes your existing .exe application and converts it to an Universal Store appx. In most cases this can happen without any code changes, and the resulting app can be deployed to the Windows Store or other UWP deployment channels (MDM solutions). It also lets you add some of the UWP features such as Live Tiles or Push Notifications, while others won't be possible with this (Adaptive Layouts). The application, though running under the new Application Model will still run with the same permissions as the original .exe (not sandboxed).
So, if you are being asked to convert the app for (some of) those reasons, it might be your best solution.
If this does not work for you, there is no other choice than a complete rewrite at this point since UWP does not support Forms, you will need to use XAML, so your entire UI stack needs to be redone at which point, a complete refresh usually makes more sense.
My goal is to use adminLTE (adminLTE) interface in a corporate setting which allows for VBA scripts to run to automate task which my non-tech savy team can accomplish much quicker than by doing them by hand. (pre-filling emails, providing inventory information, creating and printing forms automatically, integrating with stamps.com, reference and display a lot of excel data). From my understanding, the execution of VBA scripts in a web browser is not allowed.
What are my options for accomplishing my goal?
Do this in an HTA file?
Am I wrong about web browser executions of VB scripts?
Do I need to build an application in Visual Studio?
I have a team of three which need to access this and share data, so it's not like an entire enterprise spread across the nation or anything like that. Thanks.
Any and all thoughts are welcome.
This question is pretty broad - it's the same as asing "what are my options for executing an arbitrary EXE on an end user's computer from a browser." The whole point of browser based applications is to prevent this from happening for security reasons.
If your goal is to deploy VBA scripts to everyone in your organization - that's actually pretty easy - just create an automatically updating Excel addin. This approach is very common and easy to do (more info if needed).
To answer your questions:
Too broad
Yes you can do this in a HTA file but I don't recommend it and I don't think it does what you want.
You cannot run VBA within a browser in the traditional sense. An HTA from what I understand is essentially a desktop app that is written using HTML i.e. you couldn't deploy an HTA to example.com.
You can build a ASP.NET web app in Visual Studio and have your front end (e.g. Admin LTE) call an end point on the backend which then calls an EXE but that would be an EXE on the server and not the client.
I have a universal Windows 8.1 app that uses the same code in the code-behind files but has significantly different layouts for PC/tablet and phone. To make the transition to Windows 10 easier (and so I only have to manage one code-behind file) I want my project to use only one XAML file. I don't know much about view states but I'd guess that's how I'd keep separate layouts for the different platforms. What's the best way to go about this?
You can listen to the Window.Changed in your code behind and call VisualStateManager.GoToState to tell your UI to apply a VisualState you've defined.
In Windows 10 there will be AdaptiveTriggers that will eliminate the need to manually listen to the Window.SizeChanged event, so it's the closest and easiest analogy.
I understand ( How does windowing work in qt embedded? ) that you should run one Application as the QWS Server to provide window management facilities, but that you can run other Apps with graphical interfaces as well in Qt Embedded for Linux.
I want to programmatically switch focus between windows without requiring mouse / keyboard interaction to achieve focus. I've searched the following docs but am not seeing any way to make a different window 'active':
http://qt-project.org/doc/qt-4.8/qwsserver.html
http://qt-project.org/doc/qt-4.8/qapplication.html
http://qt-project.org/doc/qt-4.8/qsessionmanager.html#details
http://qt-project.org/doc/qt-4.8/qwswindow.html
QWSServer has a method:
const QList<QWSWindow *> & QWSServer::clientWindows ()
Which returns a list of QWSWindows, but I don't see how I can make one of those windows the currently active window. How can I do this? Thanks -
The accepted answer is false in some sense. I think solution is to find needed window by clientWindows, then call QWSWindow::setActiveWindow() and then QWSWindow::raise().
QWSWindow provides the undocumented raise() method. See: qwindowsystem_qws.h definition of QWSWindow. You need this type of functionality if you want to make any sort of window manager.
Undocumented can beat impossible in some situations.
It is even more complex and difficult, if you wish to let non-Qt applications have focus, etc.
If you are trying to do it using QWSServer::clientWindows (), then forget about it. QWSWindow and QWSClient are just providing interfaces to get information about client windows. You can not control them from the server application.
There are two ways to do what you want :
do it from the application creating the window
embed the client windows using QWSEmbedWidget, and then you get some kind of control