c# - Is it possible to package WPF window as COM Object -


I am trying to use a WPF window from a legacy c ++ unmanaged gtk GUI application. Is it possible to package this WPF window (including the xaml file) and use it as a regular com object in the C ++ GUI application? Do you predict any problems or problems with this approach?

If possible, any suggestions on any link or tutorial or how to do it would be very helpful thanks.

I do not know about any tutorials online for doing this; But this should not be a big problem. I have tried to apply this kind of problem and it worked fine for me, the sequence of steps given below is if I did:

1. "wpf user control" or " Wpf custom control "your solution to the library

2. Add a new WPF window class (add-> window -> ...) to the new project. Then add the ever wpf you like your new window, it works in order to check it after

3. WordPress add new classes and interfaces in the project and put it down as an example define:

  [Comvejibl (true)] [Gid ( "694 C 1820-4 9 -4988-9 28 F-FD 858 B 9 5 C-881")] public interface Aitest Dblupiaiftrfes {[Dispid (1)] zero testwopf (); } [ComVisible (right)] [Guid ( "9E5E5FB2-219D-4ee7-AB27-E4DBED8E123F"), ClassInterface (ClassInterfaceType.None)] public class TestWPFInterface: ITestWPFInterface {public void TestWPF () {Windowl form = new Windowl (); Form.Show (); }}  

4. Create your assembly com view (register for COM interop key in the Build tab of project properties) and assign a strong name to it (see the Signing tab); S Generate Key with UK utility

5. Once you're going to be all above a debug generated your_wpf_lib.tlb file \ release folder

6. Your C + + app (I think you can combine: the source for it again), line add the following:

Import "C: \ full_path_to_your_tlb \ your_wpf_lib.tlb"

This should generate the appropriate. Your Win32 project debug output folder tlh file

7.now you can call your form of C ++ code:

  TestWPFForms :: ITestWPFInterfacePtr comInterface (__ uuidof (TestWPFForms :: TestWPFInterface); ComInterface-> TestWPF ();  

This should show its WPF look


Besides, I believe the links below may be useful to you.

Hope it helps,


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -