Question Locked

OCX Updating. Why need to remove, save, then re-add to make work each time

0 helpful
26 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

So I am making some OCX's. Primarily to wrap the date picker, progress bar and listview. 3 controls Microsoft keeps wrecking on us in our VBA environment. I have compiled them into a VB6 generated OCX.

However, each time the OCX is recompiled (feature creep). The properties of the control just disappear. You need to go into the VBA project, delete and re-add the custom controls for them to work again. Is there a reason this is so, can I fix it? Maybe something I need to set in the VB6 compiler to make them properly update older versions?

26 replies

by tony hopkinson

It's decided the reference is out of date or broken.
Build number, or guid probably

or that you need to unregister and register the ocs around each build.

by slayer_

Same version number etc. Tried un-registering and then re register, tried just re-registering.

by oldbaritone

It's been a long time, but I vaguely remember something you can set in project properties, and when you use "old version" calls, it needs to be explicitly added into the project.

Last time I did something like that was way back in the 98/98se days - SE was when the NTVDM was brought into the 9x model, and old DOS PEEK/POKE and INP/OUT calls didn't work any more, unless you jumped through some major hoops.

It's been a long time. My age is showing....

Pass the Geritol

:-)

by seanferd

You are using the VB6 IDE, yes? This would be a property of the project set at design time. Maybe even for the form in which the controls reside.

I know very little of this, but that is how it would make sense to me.

by slayer_

Though it is something in the back pocket. But I suspect the controls created would have the same issue. in VB6, if the OCX or DLL is updated, it pops up a message then updates them all in your program. If its compiled, it just updates them anyways.

under VBA, if they get updated, they just break. it's like the public interface just disappears. The control still works, but it no longer has propertise or methods or events. the only way to get them back is to remove them. Save, close, reopen and re-add them. Thats a big problem. We have updated OCX's and DLL's before without this problem, so why does my custom OCX have this problem?

by slayer_

Looks like the same as just using regasm on a DLL with some switches is it not?

by slayer_

I will check

-Edit
I don't see anything useful for this problem under UserControl. Though I found some other useful stuff :).

If I knew how to export the public interface into a text doc, I would and post it.

by seanferd

Properties in the IDE, not properties of the code.

I may just have to load up VB6 and look, now.

by slayer_

Again, wish I could print em off. But the properties of, lets call it the canvas, are very basic.

The properties of the project, is only the name.

[b]Version Compatibility

Allows you to set the level of version compatibility

No Compatibility ? Compatibility not enforced.

Project Compatibility ? If checked, the Location box is active and allows you to search for the file with which this project is to be compatible. If cleared, the Location box is not available.
For all ActiveX project types, Project Compatibility is checked by default.

Binary Compatibility ? Useful for maintaining compatibility among projects that have been compiled using your component.

File Location Box ? Displays the name and location of the file with the project is to be compatible. You can type a name and location or can use the Browse button to display the Compatible ActiveX Server dialog box where you can locate the file.
[/b]
Maybe this is what I need, it is currently set to project, maybe I need to set it to Binary?

by seanferd

More along the lines of keeping all the elements or whatever persistent and consistent across compiles.

I'm thinking more along the lines of: What is causing the need to re-add these controls? Is the addressing/offset/pointers changing too much in the compiled binary, or are they simply not added in at compile time due to an environment/include setting in the IDE or itself?

You'll have to forgive me, but I am not a coder by any strech of the imagination, and it has been a long time since I played with VB6. (Gave up on the bizarre amount of crap involved in calling a standard FileOpen/Save dialogue box in any language. :p )

edit: And I never played with creating an OCX. I just hate ActiveX.

edit:
When you add features due t creep, do the tabindexes or anything else for the controls change?

edit:
You may find something relevant here:
http://www.vb6.us/
and there is a forum. Not sure how active the VB6 forum might be, didn't check.

edit:
Hrmm.
http://stackoverflow.com/questions/712470/vb6-silently-deleting-huge-chunks-of-control-data-from-forms

by slayer_

If you watch the registry, it is adding versions to it. Every time I compile it, it adds a version number, even though I am not changing the OCX's version. It isn't just re-registering over top of the old registry entries..

by seanferd

As I thought you had said you were de-registering the file first. That should blow away the prior entry. Unless! You hadn't tried un-registering on the first attempt.

Maybe blow away all those entries manually. From that point, always un-register first. (And maybe check the reg to see if it actually did so.)

I wonder if this has anything to do with registry permissions, or WinSxS. Shot in the dark.

by slayer_

Need to do it again infact, VBA shows the control as "Unknown" registry must be wrecked again. But either re-registering it, unregistering it, or doing nothing and just replacing the file, all seem to cause the same problem.

Also, our update process is automated. We can tell it to unregister then re-register the OCX on each update, but it would end up doing it after every update, major or minor.

However, re-registering the same version of the OCX does not show any issues, it doesn't add an extra version to the registry.

It is possible that VB6 is keeping a second version somewhere. Perhaps I should open it up in a hex editor or res hacker and see if the version number is somewhere in there. If it is, I could then edit this number before sending it to production each time.

by slayer_

This is from the res hack.

1 VERSIONINFO
FILEVERSION 1,0,0,23
PRODUCTVERSION 1,0,0,23
FILEOS 0x4
FILETYPE 0x2
{
BLOCK "StringFileInfo"
{
	BLOCK "040904B0"
	{
		VALUE "Comments", "XXXxxxxxxxx Custom Controls"
		VALUE "CompanyName", "XXXxxxxxxxx"
		VALUE "ProductName", "XXXxxxxxxxx Custom Controls"
		VALUE "FileVersion", "1.00.0023"
		VALUE "ProductVersion", "1.00.0023"
		VALUE "InternalName", "XXXxxxxxxxx"
		VALUE "OriginalFilename", "XXXxxxxxxxx.ocx"
		VALUE "OLESelfRegister", ""
	}
}

BLOCK "VarFileInfo"
{
	VALUE "Translation", 0x0409 0x04B0
}
}

Whereas the Registry says a much higher version (I X'd out the names, never know if a co-worker or some management type might read these things)

Registry says Version 24 in some areas, 18 in some, 120 in others (Probably my registry corruption from compiling and testing this thing so many times). I will kill off these entries and try registering again and checking what version it gives it.

by slayer_

In the IDE, Click Project menu and choose %ProjectName% Properties.

Go to the Component tab
And choose Binary Compatibility
Then, Type in the path to the compiled location of the DLL (assuming as static location)

Thanks everyone for helping, you all get thumbs

by seanferd

Glad to hear you worked it out.

So, did you have to put up with that behavior daily until now? :0 Never again, I hope!

by slayer_

We are just making the cut offs today and starting to use the new OCX. Any existing screens will be updated on the next release.

Its what reminded me of this post and that I should conclude it.

This discussion is closed to new replies.