Closed melanysoft closed 6 years ago
Thanks for your report. VBRUN is used in some enums and object types and accessible public interface wise. The error in type lib. I don't know. Have you installed OLEGuids.tlb ? Normally it's not needed as it gets compiled into and there is no public declaration from it. But who knows, maybe .net has problems without it. I just can confirm that office vba will run it. For .net it's not tested but would be great if it works there too.
Please try VBCCR15 only. The older had some critical flaws for some vtable handling.
Thanks Krool, I'll investigate more and try to find a fix. I'm trying with VBCCR15,and yes, I did install OLEGuids.tlb. Ill post you the fix if/when I find it :)
The reason for unsuccessful creation of AxInterop wrapper is a "faulty" definition of property Value in the class Hotkey. The problem is caused by using ByRef definition of parameter Modifiers.
Definitions that don't work:
Public Property Get Value(Optional ByRef Modifiers As VBRUN.ShiftConstants) As VBRUN.KeyCodeConstants
and
Public Property Let Value(Optional ByRef Modifiers As VBRUN.ShiftConstants, ByVal NewValue As VBRUN.KeyCodeConstants)
Working definitions:
Public Property Get Value(Optional ByVal Modifiers As VBRUN.ShiftConstants) As VBRUN.KeyCodeConstants
and
Public Property Let Value(Optional ByVal Modifiers As VBRUN.ShiftConstants, ByVal NewValue As VBRUN.KeyCodeConstants)
After compiling, VB.Net (and C#) can import VBCCR15 controls and place them directly on .Net forms. But, while testing in VS 2013, so far I've managed to put only the LabelW control without a crash. I've tried: TextBoxW, CommandButtonW and OptionButtonW and all of them resulted in crashing the IDE right after they're shown on the form.
Preceding the crash, all controls get fully drawn on the form with their default properties, although I must note that the size of them is "square" and not following the mouse pattern drawn while placing.
They don't crash if I first place them on a VB6 UserControl and then alltogether wrap in .Net. It looks like there is some problem while reading the container properties of .Net Form.
Please check if suggested fix fits with the rest of the project.
BR, Milan
Thanks so far.
Public Property Get Value(Optional ByVal Modifiers As VBRUN.ShiftConstants) As VBRUN.KeyCodeConstants
It is intended that Modifiers is ByRef and not ByVal. Can you please try if 'ByRef Modifiers As Integer' will also fix the issue?
Suggested new definitions to be tested:
Public Property Get Value(Optional ByRef Modifiers As Integer) As VBRUN.KeyCodeConstants
and
Public Property Let Value(Optional ByRef Modifiers As Integer, ByVal NewValue As VBRUN.KeyCodeConstants)
Hi Krool, sorry for not being able to test the suggested solution before - a busy month I guess. Anyway, it works when defined as you suggested.
Is this solution going to be implemented in VBCCR15, or do you suggest me to keep this on a private fork ?
From the InteliSense point it's always useful to have an enumerator, so maybe it would be OK to redefine (rewrite) the VBRUN.ShiftConstants to VBCCR version, using same names and values as in the original.
Thanks, BR
SSDSD
Hi Krool, I'd like to thank you and express my respect to the project you have built and maintain. Your controls are great and stable so I implemented some of them my software product in Serbia. If there is something you need help with, I'd be glad to do that (if capable :)
As for the issue, it's about referencing the VBCCR library (or any of user-controls built using VBCCR components) from VB.net (tried versions 2013-2017).
VB.net interops with ActiveX controls making a wrapper automatically. It works for MSHFlex, my own VB6 built user controls, and some other controls I've tried. But when referencing VBCCR13.ocx (or VBCCR15.ocx) following warning errors occur preventing Vb.net to build the wrapper:
Now, I must mention that the component is registered correctly and fully functional from within VB6.
Note
The question is, do you have any idea, or some advice what should I do, or where to start looking in the source code to help resolve this issue, and make VBCCR referable from within VB.net ?
Thanks andd best regards,
Milan