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. Convert COM component to C++ managed Assembly

Convert COM component to C++ managed Assembly

Scheduled Pinned Locked Moved Managed C++/CLI
csharpcomc++hardwaretutorial
1 Posts 1 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.
  • P Offline
    P Offline
    Paul Farry
    wrote on last edited by
    #1

    I currently have a COM component (and source) that talks to a printer and also a hardware port through a Vendor supplied DLL that makes fairly low level calls, and was wondering if there is a reference for displaying how to create a Managed Assembly in C++ that can performed the unmanaged calls, but present a nice .Net interface for the other developers. It does lots of GetProcAddress and I would prefer not to interop to my existing COM Component, because I am trying to get a clean project. I could possibly do it in C#, but wondering if it would be better in managed C++? PORTOUT PortOut; PORTWORDOUT PortWordOut; PORTDWORDOUT PortDWordOut; PORTIN PortIn; PORTWORDIN PortWordIn; PORTDWORDIN PortDWordIn; SETPORTBIT SetPortBit; CLRPORTBIT ClrPortBit; NOTPORTBIT NotPortBit; GETPORTBIT GetPortBit; RIGHTPORTSHIFT RightPortShift; LEFTPORTSHIFT LeftPortShift; ISDRIVERINSTALLED IsDriverInstalled; ... and then makes calls like this ... LoadIODLL(); PortOut(0x2E,(unsigned char) 0x87); PortOut(0x2E,(unsigned char) 0x87); PortOut(0x2E,(unsigned char) 0x07); PortOut(0x2F,(unsigned char) 0x07); PortOut(0x2E,(unsigned char) 0xf1); ... hio = LoadLibrary("cashdrawerio.dll"); if (hio == NULL) { return; } else { PortOut = (PORTOUT)GetProcAddress(hio, "PortOut"); PortWordOut = (PORTWORDOUT)GetProcAddress(hio, "PortWordOut"); PortDWordOut = (PORTDWORDOUT)GetProcAddress(hio, "PortDWordOut"); PortIn = (PORTIN)GetProcAddress(hio, "PortIn"); PortWordIn = (PORTWORDIN)GetProcAddress(hio, "PortWordIn"); PortDWordIn = (PORTDWORDIN)GetProcAddress(hio, "PortDWordIn"); SetPortBit = (SETPORTBIT)GetProcAddress(hio, "SetPortBit"); ClrPortBit = (CLRPORTBIT)GetProcAddress(hio, "ClrPortBit"); NotPortBit = (NOTPORTBIT)GetProcAddress(hio, "NotPortBit"); GetPortBit = (GETPORTBIT)GetProcAddress(hio, "GetPortBit"); RightPortShift = (RIGHTPORTSHIFT)GetProcAddress(hio, "RightPortShift"); LeftPortShift = (LEFTPORTSHIFT)GetProcAddress(hio, "LeftPortShift"); IsDriverInstalled = (ISDRIVERINSTALLED)GetProcAddress(hio, "IsDriverInstalled"); }

    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