2
votes

I am looking for a way to have VB6 edit a controls' propertybag right before or while the Form is being saved..

We're using an activeX control (AxisMediaControl) that seemingly uses Spaces in it's propertybag names which throws an error when trying to save the form the control is on.

System Error &H80070057 (-2147024809)

The same problem is described here: Source of a similar problem, but i don't have *.h files ()

but since we use the compiled ActiveX i can't edit the way it handles writing properties, and we don't have access to the source of the ActiveX..

I've managed to create a workaround loading the control at runtime,as an Array of objects, but this way i wont have them indexed to capture events by index.

Dim Axis(1) As AxisMediaControl
For i% = 0 To 1
   Set Axis(i%) = Controls.Add("AxisMediaControl.AxisMediaControl.1", "AMC" & i%)
   Axis(i%).Tag = "CAM" + Format$(i%)
Next i%
'   Play Video

    With Axis(0)
        .Top = 600
        .Left = 240
        .Width = 9135
        .Height = 5535
        .Visible = True

        .StretchToFit = True
        .MaintainAspectRatio = True
        .EnableContextMenu = True

        .MediaFile = VideoFile$
        .play
    End With


'   Play Stream

    With Axis(1)
        .Top = 6840
        .Left = 240
        .Width = 9135
        .Height = 5535
        .Visible = True

        .StretchToFit = True
        .MaintainAspectRatio = True
        .EnableContextMenu = True

        .MediaFile = VideoStream$
        .play
    End With

The ActiveX is working fine with younger versions of Visual Basic like express 2005 or vb.net and only occurs under vb6.

Are there ways to 'edit' the way the properties are saved to the propertybag?

Can i edit the dll or ocx to behave differently and have a working up-to-date version of an ActiveX that was previously incompatible? I've tried using Resource Hacker on the dll files but to no avail since my knowledge there is limited..

1
This is perhaps an XY problem. How do you know what the control is saving to its property bag if you don't have the source for it? (Or I'm just not understanding the posted question)MarkL
I think you understand perfectly, i dont know exactly what is beeing saved. Which is why ultimately i need a way of retrieving the properties that are beeing saved,before they are saved... and subsequently, after retrieving these, come up with a way of beeing able to save the form while the culprit control is still on it (since i need the indexes and be able to use load commands. Something like a replace() i could perform on these properties.. make any sense?RkdL

1 Answers

1
votes

Since you mentioned the control works in dotnet versions of VB, a workaround could be to write a wrapper in VB.NET, and then use that wrapper from VB6. This wrapper would provide a standard "ActiveX" (COM) interface and internally just call the original control. You would only need to expose the bare minimum of functionality in the wrapper, just to minimize the effort involved.

(Note - while this might work technically it may not be the best overall solution. For instance, if upgrading to a more modern control is possible that might be a better investment of time.)


Edit 1: A wrapper would impose some additional overhead, that is certain. But this overhead might not be important at all. If you only have to make a few calls for instance the runtime effect is probably irrelevant. OTOH if you have to call this thing within the innermost loop of some algorithm (doubtful for a UI control but...) that could be more of a problem.

Edit 2: If you don't already have any dotnet components in your app it might not be worth adding that dependency just for this issue. Or maybe it would be, if this truly is a showstopper; but that could be an additional consideration to think through carefully.