Answered by:
How to expose property of ocx built by C++(MFC) to be accessed from VB6

Question
-
I have a ocx code which was built by C++(MFC)
I added a property to it.
I want to access that property from VB6 but can't.
I copied just ocx file.(there are lots of files are in the \Release folder including *.exp, *.lib, *.obj, *.tlb..
Which files should I copy additionally to the VB6 application folder?
Or what do I do to make it work?
Answers
-
-
Hi Jeff0803,
Thank you for posting here.
According to your description, we recommend you could follow this doc to try to register the ocx file into your program. Then check if it could work.
BTW, since this issue is more related to development with VB6 and ocx files, we also recommend you could redirect to VB6 forum or Neowin forum, where you could get better support.
Best Regards,
Dylan
MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com
- Marked as answer by Jeff0803 Tuesday, November 5, 2019 3:49 PM
-
I found how to add propery from the "Add Property" and compiled.
I copied *.ocx to the correct folder and now my VB6 program can see the property.
However an error occur when access the property like following.
Unexpected Error #440 Automation error ......
Can you please give me any advice?
- Marked as answer by Jeff0803 Tuesday, November 5, 2019 8:37 PM
All replies
-
-
Hi Jeff0803,
Thank you for posting here.
According to your description, we recommend you could follow this doc to try to register the ocx file into your program. Then check if it could work.
BTW, since this issue is more related to development with VB6 and ocx files, we also recommend you could redirect to VB6 forum or Neowin forum, where you could get better support.
Best Regards,
Dylan
MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com
- Marked as answer by Jeff0803 Tuesday, November 5, 2019 3:49 PM
-
-
-
-
-
(I loaded .ocx, is it correct? otherwise should I load tlb? I have no idea how to make the .tlb file)
The type library should be embedded in the .ocx. If it wasn't, oleview would issue an error message when it opens the .ocx to load the type library.
Typically, the type library (.tlb file) is created by the MIDL compiler when it processes the project's idl/odl file. For a typical project, the .tlb is then embedded in the project output by the build process in the ordinary course .
-
I found how to add propery from the "Add Property" and compiled.
I copied *.ocx to the correct folder and now my VB6 program can see the property.
However an error occur when access the property like following.
Unexpected Error #440 Automation error ......
Can you please give me any advice?
-
I found how to add propery from the "Add Property" and compiled.
I copied *.ocx to the correct folder and now my VB6 program can see the property.
However an error occur when access the property like following.
Unexpected Error #440 Automation error ......
Can you please give me any advice?
- Marked as answer by Jeff0803 Tuesday, November 5, 2019 8:37 PM
-