Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. wrapping unmanaged classes for controls

wrapping unmanaged classes for controls

Scheduled Pinned Locked Moved Managed C++/CLI
csharpc++csscomdesign
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BlackDice
    wrote on last edited by
    #1

    I would like to wrap an mfc control class (Chris Maunder's MFC Grid control) to be used in C#. Does anyone know of a link to teach me how to do this? I kind of understand the part about wrapping classes, but what about so that it actually displays on the form at runtime and design time. Forgive me if I sound stupid, but I've only been learning C# for a few days now (since Friday). I think I've got the basics, but I'd like to be able to do this so that I can use the control in C#. Any help is appreciated. Thanks!! If I write code in my sleep, does that make me brilliant, or just a lazy programmer? My articles www.stillwaterexpress.com BlackDice - the programmer formerly known as bdiamond

    U T S 3 Replies Last reply
    0
    • B BlackDice

      I would like to wrap an mfc control class (Chris Maunder's MFC Grid control) to be used in C#. Does anyone know of a link to teach me how to do this? I kind of understand the part about wrapping classes, but what about so that it actually displays on the form at runtime and design time. Forgive me if I sound stupid, but I've only been learning C# for a few days now (since Friday). I think I've got the basics, but I'd like to be able to do this so that I can use the control in C#. Any help is appreciated. Thanks!! If I write code in my sleep, does that make me brilliant, or just a lazy programmer? My articles www.stillwaterexpress.com BlackDice - the programmer formerly known as bdiamond

      U Offline
      U Offline
      ursus zeta
      wrote on last edited by
      #2

      You know, until I saw this question, I hadn't read the source for the C Maunder Grid Control. The MFC Grid Control is an impressive body of work (and, I didn't read it all the way through on first reading). I've never been in a project where you would have to wrap so many disparate types, but, it's probably best not to EVEN TRY to display that monster on a .NET Form. I'm fairly new to .NET, and, in particular the Interop marshaler, but, I don't think you could wrap the "mfc control class" (because there isn't one). It's not a COM component, and consequently, has no type library. If you wanted to pursue this strategy, you'd have to wrap each individual type that C Maunder uses in his implementation, and marshaling all that data into .NET accurately would surely drive you to (well, what's the worst thing you can imagine?). Run Time Callable Wrappers are generally for small cohesive units, like classes and interfaces and objects that are type compatible from managed to unmanaged. User defined types often require special custom marshaling routines, and much of this is trial and error. However, I'll bet Microsoft likes the C Maunder MFC Grid Control (they have spies everywhere), and, I wouldn't be surprised if they have a highly elite team of .NET code fiends working on the advanced version as we forum. The overriding concern here is: Just how different are MFC and .NET? I would recommend the book: ".NET and COM: The Complete Interoperability Guide", by Adam Nathan (everything I know, I learned from this book). To use this control in .NET, you'd have to re-write the entire thing to be compatible with the Common Language Runtime types. I think this would be a very cool commercial project. I wonder if Chris has franchised the concept yet.

      1 Reply Last reply
      0
      • B BlackDice

        I would like to wrap an mfc control class (Chris Maunder's MFC Grid control) to be used in C#. Does anyone know of a link to teach me how to do this? I kind of understand the part about wrapping classes, but what about so that it actually displays on the form at runtime and design time. Forgive me if I sound stupid, but I've only been learning C# for a few days now (since Friday). I think I've got the basics, but I'd like to be able to do this so that I can use the control in C#. Any help is appreciated. Thanks!! If I write code in my sleep, does that make me brilliant, or just a lazy programmer? My articles www.stillwaterexpress.com BlackDice - the programmer formerly known as bdiamond

        T Offline
        T Offline
        TigerNinja_
        wrote on last edited by
        #3

        I wouldn't try to wrap this class. You will be better off using the Windows.Forms.DataGrid class as your base implementation (powerful class by the way) and extending it for any further functionality that you desire. Remember, the DataGrid is different for Windows and Web namespaces respectively.

        R.Bischoff

        Tengas un buen dia

        1 Reply Last reply
        0
        • B BlackDice

          I would like to wrap an mfc control class (Chris Maunder's MFC Grid control) to be used in C#. Does anyone know of a link to teach me how to do this? I kind of understand the part about wrapping classes, but what about so that it actually displays on the form at runtime and design time. Forgive me if I sound stupid, but I've only been learning C# for a few days now (since Friday). I think I've got the basics, but I'd like to be able to do this so that I can use the control in C#. Any help is appreciated. Thanks!! If I write code in my sleep, does that make me brilliant, or just a lazy programmer? My articles www.stillwaterexpress.com BlackDice - the programmer formerly known as bdiamond

          S Offline
          S Offline
          sunhui
          wrote on last edited by
          #4

          Hi all, I will release a product in next week which can wrapping alomst all MFC CWnd as a WinForm Ctrl, if any one need, please let me know, my e-mail is sunhui@mail.apptemplate.com

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups