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