Are Winforms accessible from Unmanaged C ++?

Some classic Windows / C ++ applications cannot easily move to managed C ++. NET due to the use of external libraries. Is it possible to use newer GUI libraries, such as winforms (or even WPF) with such applications, to “reset” new controls in order to replace obsolete MFC?

Or is it really not worth it and take a long time?

+3
source share
5 answers

I found that C ++ / CLI supports very much . Are you really having problems? He should be able to directly compile your MFC project.

But mixing WinForms and MFC in the same thread can be tricky, because they both want to start their own message loop. As Ray Burns suggested, WPF might be more collaborative with MFC.

+3
source

Because of IJW, it's pretty easy to use WinForms or WPF from unmanaged code. However, you want to write new components in managed code and just embed them in your unmanaged application. This means that for all new things you do not have to deal with memory management, etc.

WPF , WinForms, WinForms, .

, WPF. COM . - - ++, . - ( ) . , .

+2

.NET- (# - ) ++ DLLS. .

. C/++ - # ASP.NET. -, winForms WPF-.

+1

, .

, ++ CLR, .

.

A simpler approach is to rewrite unmanaged code to bits, which can be called via P / Invoke or COM interoperability, and have a managed application (with winforms) that calls unmanaged code.

0
source

See my answer to a similar question.

You have many options for managing a managed user interface in MFC.

0
source

Source: https://habr.com/ru/post/1722019/