Search code examples
c++qtmfcvisual-studio-2022

getting a Win32 console app to work with MFC


I am working on updating/making a GUI for work using Qt. But Qt has to be MFC-compatible to work with our code and I don't understand what that means.

I got Qt set up in Microsoft Visual Studio but use this "guide" to convert and I'm not able to do step 2. I don't know if I'm looking at the wrong file or if I need to modify Visual Studio.

My problem is I just don't know what to do at this point.

Any suggestions, links, or hand-holding?


Solution

  • Confusing wording for sure: when they say Qt must be MIC-compatible, what they mean is that you're not relaying on any Qt GUI code. To interface with the console is a different matter, the console has nothing to do with MFC Win32 GUI code. Your library should be it's own Universe with an API that can be talked to by multiple platforms like Android NDK, UWP, Win32 MFC, etc.

    You must in your mind replace Qt with any C++ API. If I use that API, I have to be able to compile it into Microsoft Foundational Classes to make Win32 Desktop app. You will just want to ensure that your C++ code is portable and that sounds to me like it satisfies the constraint. In general you don't mix GUI toolkit. You may want to use the Model-View-Controller model. To get different toolkit to interact you need a mechanism to do that, like a state machine so that MFC can talk to your Qt code. You may also need to use a design pattern like producer-consumer, facade, or adapter pattern to interface Qt and MFC.

    If your boss is telling you to make a new MFC Desktop app, in my project management experience this is a crisis situation as trying to convince stake holders what they need when they are invested in antiquated or bottomless pit technologies can be like pulling teeth and may require you to hire an uninterested third-party consultant the stake holder will listen to. I suspect you are maintain an old app, nothing wrong with that.

    Please drop a comment bellow with any question and I will update this answer with more specifics.