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. Visual Basic
  4. VB OCX Byte Data Type to MFC

VB OCX Byte Data Type to MFC

Scheduled Pinned Locked Moved Visual Basic
questionc++help
4 Posts 2 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.
  • A Offline
    A Offline
    AntonioKeh
    wrote on last edited by
    #1

    Hi all, I create an OCX using VB6. The functions in this OCX are: Public Function TestByte(MyByte as Byte) As Byte Public Function TestInt(MyInt as Integer) As Integer Then I try to use this OCX in a MFC project and realize that MFC cannot recognize VB's "Byte". Thus the function TestByte cannot be imported to the MFC application. My question... WHY??? isnt byte a very basic data type? I can go round this problem for now... but this is a really intriguing. Feel free to tell me why... :o) Thanks.

    I 1 Reply Last reply
    0
    • A AntonioKeh

      Hi all, I create an OCX using VB6. The functions in this OCX are: Public Function TestByte(MyByte as Byte) As Byte Public Function TestInt(MyInt as Integer) As Integer Then I try to use this OCX in a MFC project and realize that MFC cannot recognize VB's "Byte". Thus the function TestByte cannot be imported to the MFC application. My question... WHY??? isnt byte a very basic data type? I can go round this problem for now... but this is a really intriguing. Feel free to tell me why... :o) Thanks.

      I Offline
      I Offline
      Ian Darling
      wrote on last edited by
      #2

      AFAIK, Byte in VB is BYTE in MFC/Win32 (or just use unsigned char). It's just a naming inconsistency between those platforms, and you should still be able to call the OCX - the interface generated for C++ would use BYTE TextByte(BYTE MyByte) as the definition (or something similar) Of course, all my experience with this is going the other way round - C++ control, VB application. -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky

      A 1 Reply Last reply
      0
      • I Ian Darling

        AFAIK, Byte in VB is BYTE in MFC/Win32 (or just use unsigned char). It's just a naming inconsistency between those platforms, and you should still be able to call the OCX - the interface generated for C++ would use BYTE TextByte(BYTE MyByte) as the definition (or something similar) Of course, all my experience with this is going the other way round - C++ control, VB application. -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky

        A Offline
        A Offline
        AntonioKeh
        wrote on last edited by
        #3

        Hi Ian, Actually I did a reverse after posting this message (writing an OCX using VC to use in VB). It appears that, OLE dont support BYTE as a parameter for OCXs... i do not understand why. I understand what you mean, Byte in VB is 1 byte, BYTE in VC is 1 byte, they are the same. I wrote DLLs for VB using VC before, and they work together... just that for OCX... Am I correct? or is there really a away to do it? Anyway, thanks for your help. :o) Keh

        I 1 Reply Last reply
        0
        • A AntonioKeh

          Hi Ian, Actually I did a reverse after posting this message (writing an OCX using VC to use in VB). It appears that, OLE dont support BYTE as a parameter for OCXs... i do not understand why. I understand what you mean, Byte in VB is 1 byte, BYTE in VC is 1 byte, they are the same. I wrote DLLs for VB using VC before, and they work together... just that for OCX... Am I correct? or is there really a away to do it? Anyway, thanks for your help. :o) Keh

          I Offline
          I Offline
          Ian Darling
          wrote on last edited by
          #4

          Could you use a variant of type VT_UI1? -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky

          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