[WPF] WPF UI Call from MFC (Feat. CLR)
Visual Studio 2022에 기본적으로 CLR 설치 안되어 있음.
Installer 들어가서
C++/CLI Support 인스톨 해야 함.
WPF Library (.Net Framework)
WPF로 만든 공용 UI (.net Framework 4.xx~로 만들어야 함)
CLR Class Library (.Net Framework)
Managed 와 UnManaged Language를 연결해주는 다리 역할의 라이브러리
UI 라이브러리 WpfNFLibrary를 참조
Managed class (WPF용)
DialogInterfaceWrapper
DialogInterfaceWrapper.h
DialogInterfaceWrapper.cpp
UnManaged class (MFC용)
NativeInterface
NativeInterface.h
NativeInterface.cpp
WPF 공용 UI 호출
InterfaceBridge.dll 참조 및 관련 .dll들 (DevExpress ) 프로젝트 속성에 참조 걸어야 함.
InterfaceBridge 라이브러리에 있는 Managed용 API 호출.
WPF에서 HWND 얻기
// get HWND of the main window, now can use the
// window handle when pinvoking system functions
IntPtr windowHandle = new WindowInteropHelper(
Application.Current.MainWindow).Handle;
MFC에서 공용 UI호출
InterfaceBridge.lib 경로 잡아줘야 함.
관련 dll 들 (DevExpress) .exe 실행파일 경로에 넣어주는걸로 작동 함.
InterfaceBridge 라이브러리에 있는 UnManaged용 API 호출.
# 실행 결과
.NET programming with C++/CLI
Learn how to use C++/CLI to create .NET apps and components in Visual Studio.
learn.microsoft.com
https://djcho.github.io/dotnet/dot-net-1/
[.NET]C++에서 WPF호출 방법
djcho.github.io
답변 링크 참조
Use localization DLLs from a croncrete path instead of GAC
You have yet to view any tickets. Your search criteria do not match any tickets. A server error occurred while processing your request. Please try again at a later time.
supportcenter.devexpress.com