Mixing MS Technologies

Using C# Windows Form User Control from C++

Page 1 of 1

0 Replies - 933 Views - Last Post: 08 December 2008 - 02:00 PM Rate Topic: -----

#1 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6246
  • View blog
  • Posts: 24,014
  • Joined: 23-August 08

Mixing MS Technologies

Posted 08 December 2008 - 02:00 PM

This could be posted in C/C++ or C#, but I'll try here in C# first and see what happens.

As a long-time Unix/Linux server developer that got sucked into the world of Windows with no formal guidance (and no one else to whom to turn), I often find myself trying to mix and match Windows technologies/platforms and spending long periods of time attempting to determine not just how to do something, but also the right way to do something. I've happened upon a situation with which hopefully someone can help me out, because I've spent the last few weeks at it and I'm not feeling any better about where I stand. I'm sure we're heading full force into the TL;DR area now, so if you haven't got the stomach for it bail while you can.

I have a DLL I developed a few years ago, written in C, which performs HTTP network calls using WinHTTP and encryption using OpenSSL. This has been previously used in two apps, one of which was written in Visual Basic 6, the other in C++. The configuration required for this DLL has been previously split up into separate ActiveX objects written in VB 6.

Obviously, given its age and questionable support from MS, I'm trying to divorce myself from VB6 at this point. At the same time I would very much like to get the configuration into a single UI object callable from C# (into which I've already ported the VB6 application), and to that end I have created a Windows Forms User Control in C#, which is exposed to COM and uses P/Invoke calls to the C DLL. This works great in the C# application, where the User Control (or, should I say, a descendent of it) is used as a property page.

The question is, what is the correct and proper way to use this User Control from a non-CLR C++-based UI? Is it an MFC dialog containing the User Control? ATL/WTL? Raw Win32? I'm not well-versed in any of these, really, so there's no real preference to me. I guess I could probably wrap the User Control in an ActiveX object that provides a dialog upon which the User Control could be placed, but I'm sort of trying to decrease the complexity of this solution, so that maybe in the future I could hand this off to a more junior developer (if we ever hire any) without having to write a book in documenting it.

Thanks foir any help you may be able to provide!

Is This A Good Question/Topic? 0
  • +

Page 1 of 1