-1

Our company has a software in Alaska Xbase++. I want to modernize the GUI with WPF, without rewriting the software in C#. In this Alaska Xbase++ language, I have the ability to call C/C++ functions. I beleive, it is possible to create hybrid DLL, which has managed code, yet callable from unmanaged language, so doing a stdcall.

So my plan is that I write a wrapper DLL which manages all the things to create a WPF window and controls (and eventloop, everything). In this Alaska Xbase++ language I would call this wrapper DLL to create WPF window and controls in my Application.

For example: -WpfWrapper.DLL In C# DLL (or application which listens data from Xbase++ app):

Function CreateWpfWindow(title) {..}
Function CreateWpfButton(caption, x, y, parent) {..}

C# DLL doing the "WPF things".

-In Alaska Xbase++ language I have a main window. But I want to modernize the GUI, I want to create some WPF window in that old Win32 app, so I call the DLL:

nHandle=CreateWpfWindow("My WPF window in Alaska Xbase++!")
CreateWpfButton("My button", 100, 100, nHandle)

This is just my thoughts.. Maybe there is other way. But I wonder is it possible to integrate IN ANY WAY WPF window and controls to an old Win32 Application? I beleive it does, either via some wrapper DLL or via some wrapper application.

Please give me some guidance how this could work. The created WPF window in my old app must be in focus, and above other windows. I have the HWND of my main window, I beleive it is neccesary.

Jung Ervin
  • 358
  • 1
  • 2
  • 8
  • If you target Windows 10 you can use the Windows Presentation Platform instead. Unlike WPF, that one has a native, unmanaged interface. – IInspectable Feb 13 '20 at 23:26
  • What is Windows Presentation Platform? Do you mean Universal Windows Platform, aka UWP? – Clemens Feb 14 '20 at 06:26
  • 1
    @cle: It's the UI technology that Microsoft have decided to not give a name. It's used by UWP applications, but can be accessed by classic desktop applications via [XAML islands](https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/xaml-islands). With [WinUI 3.0](https://github.com/microsoft/microsoft-ui-xaml/blob/master/docs/roadmap.md#winui-3) the UI platform will be fully decoupled from the UWP SDK. – IInspectable Feb 14 '20 at 07:17

1 Answers1

0

I don't know what "Alaska Xbase++" is but my guess is the question you are asking is the reverse of what you should try. You shouldn't try to build a GUI application by calling into C# from some obscure programming environment. You should try to wrap your business logic, implemented in an obscure programming environment, in a DLL and call into that from C#.

Does Xbase++ expose a C interface?

If so make a custom DLL that calls your Xbase++ code and DllImport that DLL into a WPF application.

jwezorek
  • 8,592
  • 1
  • 29
  • 46