# Visual Basic > Visual Basic 6 and Earlier >  [RESOLVED] LED.OCX & Windows 11 Pro

## daveyk021

I have one that has left me stumped for several days now.

The problem exists in both VB6 and VBA for Office.  My more extensive instrument control and test are actually written in VBA under access (for the databasing and reports).  

For years, I have used a very old ActiveX control LED.OCX.  

My first Windows 11 machine was last December, an HP that was supposed to have Windows 11 on it but came from SAMS Club with Windows 10.  HP Remoted and updated it to Windows 11 (HOME).  All my programs, both VB6 and VBA with LED.OCX work fine on that machine.

Last week, I built up a new computer myself (gaming power machine), but it is still my shop's main desk computer.  From the start, I installed Windows 11 Pro.

I can not get any of my VBA or VB6 Programs to see the LED.OCX control.  I can reference it without error (it is not one you register with the OS) on both VB6 and VBA.  The forms do not have access to it and it can not be found on the list of available activeX controls to choose from.

The main difference between the two Windows 11 machines is Home verse Pro.  I do not use any of the pro features, so WIM should not be active.  I do not touch bitlocker.  So, I am not sure what the difference is.  Both systems are 64 bit.

Thoughts, help, an LED.OCX alternative (would have to be backwards compatible to 32 bit Windows 7)?

Thanks kindly,

Dave

----------


## Elroy

> I can not get any of my VBA or VB6 Programs to see the LED.OCX control.  I can reference it without error (*it is not one you register with the OS*) on both VB6 and VBA.


I've never heard of such a thing.  You must either register it (with RegSvr32) or you must locally (within the app) register it through a manifest with the SxS technology.  I know of no other way to use an OCX file.

Or, if your app is correctly "installed" with a good installer, that installer software should register it.

----------


## daveyk021

> I've never heard of such a thing.  You must either register it (with RegSvr32) or you must locally (within the app) register it through a manifest with the SxS technology.  I know of no other way to use an OCX file.


It didn't even register in Windows 7.  You register it with the IDE of both VB6 and VBA.   Under References, IDE Code section, you browse, find it and select it.  Then it shows up as LEDD.

As I said, I have been using it for years that way.

----------


## Eduardo-

> It didn't even register in Windows 7.  You register it with the IDE of both VB6 and VBA.   Under References, IDE Code section, you browse, find it and select it.  Then it shows up as LEDD.
> 
> As I said, I have been using it for years that way.


Are you running the IDE elevated (with admin rights)?
You need to run the IDE elevated to be able to register components.

----------


## daveyk021

> Are you running the IDE elevated (with admin rights)?
> You need to run the IDE elevated to be able to register components.


Yes, and not sure how you would do that in VBA (office).

I figure it may be an added security layer in the Pro addition of Windows 11?

There may be a newer/better way to represent and LED indicator these days?  Although I would not look forward to re-coding all the projects I used LED.OCX in.

Dave

----------


## Dan_W

For VBA, the relevant Excel.Application needs to have been instaniated in admin mode - https://answers.microsoft.com/en-us/...d-7226869ecc5b

Are you using Office 64bit or 32bit?

----------


## Eduardo-

> There may be a newer/better way to represent and LED indicator these days?


If you explain what it does, and better if you post some images, maybe someone could have or recommend something.

----------


## Elroy

> It didn't even register in Windows 7.  You register it with the IDE of both VB6 and VBA.   Under References, IDE Code section, you browse, find it and select it.  Then it shows up as LEDD.
> 
> As I said, I have been using it for years that way.


Yeah, if you re-compile the OCX's source code on a specific computer (if you're elevated), the IDE will register it during compilation.  But, one way or another, it's got to be registered to use the OCX (unless it's set up for SxS in the program's manifest).

----------


## daveyk021

> If you explain what it does, and better if you post some images, maybe someone could have or recommend something.


This example (attached) is one of the more crude examples, but it was at-hand.  You can make them look better than this.  While a given test is running, its LED will blink yellow.  If the test passes, it then changes to a solid green.  If it fails, the LED changes to a solid RED.

I'll have to find a better example.

Dave

----------


## Elroy

Ohh, are we talking about an LED-looking control?  Hmm, all the registering stuff still applies ... but I thought we were talking about actually controlling some physical LED.

If all we want is some control that "looks like" an LED, for goodness sakes, just quickly write a user control that does it.

Shucks, if you give me some pictures and specifications, I'll knock it out for you.

----------


## daveyk021

See above please.  Need a color and a blink attribute (don't want a timer control), and hopefully a title/tag (i.e. "PA Amplifier RF Filters..").  I'm sure you can make a better looking one.  It will require a rework of several programs, but that should not take all that long.

I've never tried to make my own control and could use pointed to lesson for that 8-).

----------


## ahenry

Sounds like you didn't register it in an elevated command prompt.  regsvr32 should work for any normal OCX, and it doesn't sound like this is anything special.

----------


## daveyk021

> Sounds like you didn't register it in an elevated command prompt.  regsvr32 should work for any normal OCX, and it doesn't sound like this is anything special.


Oh yea I have.  I know to open CMD as Admin..  You can not register LED.OCX even under Windows 7/32.  You just reference it in your program IDE and it works that way, but not under Windows 11 Pro.

----------


## Elroy

daveyk021,

Ok, I'll mock something up.

Is it ok if I use a Timer API call?  I don't see another way to do it without doing that.  And it'll be slow enough that you'll never notice it in terms of system resources or performance.  A timer that slow isn't going to hurt anything.

----------


## Elroy

Actually, I'm going to put a timer control on the user control so I don't need a BAS module for the callback.  Again, I don't see how this can be a problem.

----------


## Elroy

_NOTICE:  Grab the latest version in subsequent posts below.
_
Here, see if this'll get you going.

I've attached a demo project.  But, to use it, just drag that LedUserControl.CTL file into your project, and then it'll appear in your toolbox.  Use it wherever you like.

This picture doesn't show it blinking, as I didn't want to mess with capturing a video.



Here are the custom properties it has:

State (on or off)BlinkIt (boolean)BlinkRate (milliseconds)LedColor (an OLE_COLOR)BorderColor (another OLE_COLOR)Font (for the caption)

And the only event I setup was a *Click* event.  If you want other events let me know and I'll set them up for you.

EDIT:  Ohhh, I wanted to give you a way to size the LED light.  Give me a moment and I'll set that up.

----------


## Elroy

Ok, I added both a *Size* and *BorderWidth* property.

----------


## Elroy

I guess you also need a *BackColor* for the thing.  That's now been added as well.

----------


## dilettante

Now all you need to do is antialias the circles.  :Wink:

----------


## Elroy

> Now all you need to do is antialias the circles.


Boooo.   :Stick Out Tongue:   Yeah, I saw that, but I'm not going to fire up the GDI+ for this thing.

----------


## dilettante

Well the other alternative is to render to a secondary hDC at 4x, then downscale by 4x using StretchBlt() in HALFTONE mode.  Does a pretty good job, and you can either use an invisible PictureBox or a memory DC as the secondary.  Of course the latter doesn't let you use VB's drawing primitives, so you need a few more API calls.

----------


## Elroy

> Well the other alternative is to render to a secondary hDC at 4x, then downscale by 4x using StretchBlt() in HALFTONE mode.  Does a pretty good job, and you can either use an invisible PictureBox or a memory DC as the secondary.  Of course the latter doesn't let you use VB's drawing primitives, so you need a few more API calls.


hahaha, yeah, well, I'll wait and see what he has to say.  We didn't even get any pictures of what he has now, which would have been nice.  I also thought about putting a shadow on it, or make it a bit more 3D, but hey, it's free.   :Smilie: 

Also, that thing doesn't currently have _any_ API calls in it.

----------


## Eduardo-

I made one but without caption.
It has antialias since it is based on ShapeEx that uses GDI+.



PS: Updated, I made a couple of adjustments.

----------


## Elroy

> I made one but without caption.
> It has antialias since it is based on ShapeEx that uses GDI+.


I haven't even looked at it, but maybe I should use it as a sub-UC to mine.   :LOL: 

We'll get this guy _really_ fixed up.   :Smilie:

----------


## Elroy

Ok, here it is with Eduardo's GDI+ improvement (anti-aliasing to draw the circle).

Now, to use it, you've got to copy these three files into your project's source folder:

LedUserControl.ctl
ShapeEx.ctl
ShapeEx.ctx

And then grab the LedUserControl.ctl and ShapeEx.ctl user controls and put them into your project.

Here's a picture.  It does look nicer:



ADDED:  And here's a picture of the Size property made much smaller, and the control's BackColor the same as the form.  It looks good.

----------


## Eduardo-

I've put mine in the Codebank (an improved version of what I posted on message #23): LED control.

----------


## dilettante

How about a little more 3D "gemmy" appearance?

Quick hack, no antialiasing, just to give an idea of what I mean:



```
Option Explicit

Private Declare Function Ellipse Lib "gdi32" ( _
    ByVal hDC As Long, _
    ByVal Left As Long, _
    ByVal Top As Long, _
    ByVal Right As Long, _
    ByVal Bottom As Long) As Long

Private Sub LED(ByVal X As Long, ByVal Y As Long, ByVal Color As Long, ByVal Delta As Long)
    Dim L As Long
    Dim T As Long
    Dim R As Long
    Dim B As Long
    Dim I As Long

    L = X - 1
    T = Y - 1
    R = L + 2
    B = T + 2
    DrawWidth = 2
    ForeColor = Color
    For I = 1 To 5
        Ellipse hDC, L, T, R, B
        ForeColor = ForeColor - Delta
        L = L - 1
        T = T - 1
        R = R + 1
        B = B + 1
    Next
    For I = 6 To 15
        Ellipse hDC, L, T, R, B
        ForeColor = ForeColor - 6 * Delta
        L = L - 1
        T = T - 1
        R = R + 1
        B = B + 1
    Next
    ForeColor = vbBlack
    Ellipse hDC, L, T, R, B
End Sub

Private Sub Form_Load()
    AutoRedraw = True
    LED Int(ScaleX(ScaleWidth / 2, ScaleMode, vbPixels)) - 30, _
        Int(ScaleY(ScaleHeight / 2, ScaleMode, vbPixels)), _
        vbRed, _
        &H2&
    LED Int(ScaleX(ScaleWidth / 2, ScaleMode, vbPixels)) + 30, _
        Int(ScaleY(ScaleHeight / 2, ScaleMode, vbPixels)), _
        vbGreen, _
        &H200&
    LED Int(ScaleX(ScaleWidth / 2, ScaleMode, vbPixels)), _
        Int(ScaleY(ScaleHeight / 2, ScaleMode, vbPixels)) + 35, _
        vbYellow, _
        &H201&
    LED Int(ScaleX(ScaleWidth / 2, ScaleMode, vbPixels)), _
        Int(ScaleY(ScaleHeight / 2, ScaleMode, vbPixels)) - 35, _
        &HFFD000, _
        &H10200
End Sub
```

----------


## Eduardo-

> How about a little more 3D "gemmy" appearance?


Done.

----------


## Elroy

daveyk021, just as an FYI, if you ever come back, and you're truly interested in learning how to make your own custom-user-controls (UC), start by exploring what I gave you in post #18.  It's a straightforward example with no API calls, and it has all the essentials of making your own UC.

Eduardo's StyleEx.ctl (and it's ctx) are clearly prettier, but that StyleEx UC has a thunk (inserted machine code) as well as subclassing in it, in addition to using the GDI+ library ... all of which are at a pretty high level.  And that's also a chunk of code with much in it that you don't need.  Just saying.

I'm tempted to write a version with GDI+ that does the anti-aliasing (and maybe also the 3D appearance), all included in the LedUserControl.CTL, but I'll wait to see where you're at with all of this.

----------


## Elroy

I didn't have anything better to do, so I went ahead and got my version working with GDI+.  I must admit that I peeked at Eduardo's ShapeEx.ctl while doing it.  Eduardo, I certainly hope you don't mind that.

Here are the features:
All in one CTL (and no CTX).No thunk (machine code).No subclassing.Ring is anti-aliased for smoothing.LED has 3D option.Unicode caption.

Here are the properties (other than the properties automatically supplied, such as Visible, Index, Size, etc.:
State (On, Off, Blinking)BackColor (of the actual control)BorderColor (of the LED light)BorderWidth (of the LED light)BlinkRate (in milliseconds)CaptionColor (of the font)CaptionLedColor (of the actual LED light)LedSizeThreeD (of the LED light)

Also, just as an FYI, I didn't tie anything to the size of the control, so you are responsible for making sure the LED and the Caption will fit.

There's also a Refresh method.  The only time that's really necessary is when you grab a reference to the Font property, and then use that reference to change the font.  Grabbing that reference that way, the "Set Font" is never called, so it doesn't get a chance to refresh.  I initially had a timer, but that really wasn't so good.

Here's a picture of what the demo now looks like:


To use it, just put the LedUserControl.CTL into your project, and it'll appear in your ToolBox.  I didn't put a specific Icon in it, as I didn't want a CTX file generated.

Ok Dil, what else can be done to it.  :Stick Out Tongue: 

Enjoy

And, as a note to davey, I still say you start with my post #18, and not this one.  That post #18 is quite simple, and has the basics of custom-user-control creation.

----------


## dilettante

Well if you don't use a Timer control is there any good reason not to make it a LightWeight (windowless) control?

Does it do text-wrapping for long Caption values?

----------


## Elroy

> Well if you don't use a Timer control is there any good reason not to make it a LightWeight (windowless) control?


I do use the timer control, just not for Font changes.  I suppose I could use the timer API, and have the callback into that CTL.  Not exactly sure what that buys us though.

Hmmm, lightweight?  Don't know if that's needed or not.  I do use the UserControl's Font to store the Font, but I could create a Font object to do that.

----------


## Elroy

> Does it do text-wrapping for long Caption values?


hahaha, I just spotted that.   :Smilie: 

That'd be a chunk of work, given that I'm using TextOutW for the caption.

EDIT:  I might also want to vertically center the LED on the control.  I'm just currently putting it at the top-left.  But, if centered, I could also just center the caption.  That'd work out better for any multi-line caption.

----------


## Eduardo-

> I didn't have anything better to do, so I went ahead and got my version working with GDI+.  I must admit that I peeked at Eduardo's ShapeEx.ctl while doing it.  Eduardo, I certainly hope you don't mind that.


The code I share is for people to use it, so of course I don't mind.




> Well if you don't use a Timer control is there any good reason not to make it a LightWeight (windowless) control?


A Timer control does not prevent you from making a UserControl windowless.
BTW, my ShapeEx and LED controls both have timers and are windowless.
You only can't have windowed controls but can have windowless and invisible controls inside.

----------


## dilettante

> A Timer control does not prevent you from making a UserControl windowless.


Good catch.  I was rushing and did not think it through.

----------


## Elroy

I just toggled the WindowLess property on mine and nothing complained.  So, I'll just leave it to whoever wants to use it.   :Smilie:

----------


## xxdoc123

Enthusiastic friend

----------


## Elroy

Ok, here it is as LightWeight and caption that wraps (using DrawTextW instead of TextOutW).

Anything else?  :Stick Out Tongue: 

And hmmm, I wonder if Davey is ever coming back.

----------


## dilettante

It hasn't been clear to me why an Image and Label control and a series of GIFs for the required colors wasn't good enough to do the entire job anyway.  Easy enough to hold the GIFs in a series of invisible Image controls.

Ok, maybe blinking, but still no big deal.  Either wrap it in a UserControl or not as required.

----------


## Elroy

> It hasn't been clear to me why an Image and Label control and a series of GIFs for the required colors wasn't good enough to do the entire job anyway.  Easy enough to hold the GIFs in a series of invisible Image controls.
> 
> Ok, maybe blinking, but still no big deal.  Either wrap it in a UserControl or not as required.


Probably would have been.   :Smilie:

----------


## dilettante

Or even easier, a Shape control.

----------


## Elroy

> Or even easier, a Shape control.


That's what I started with on the UC I wrote.  Wasn't much more than a Shape and a Label.

----------


## daveyk021

Hello Elroy, thank you very much.  I am not ignoring you; I just got super busy work and personal and have not been able to get back to the project.  I will here later this week and appreciate all your efforts!!! 8-)

----------


## Elroy

> Hello Elroy, thank you very much.  I am not ignoring you; I just got super busy work and personal and have not been able to get back to the project.  I will here later this week and appreciate all your efforts!!! 8-)


Hey Davey,

Not a problem at all, and I completely understand.  I'm just an old retired guy (just turned 70), who likes to keep his hand in this stuff (see if I can keep a few brain cells firing).

Post #38 (above) is really a nice version of the control.  It's fairly complex, but it is a single CTL file that you could just include in your project.  Again, if you want to learn how to write user-controls, post #18 is a nice (fairly simple) example of a user-control (although not as "pretty" as the one you get from post #38).

Best,
Elroy

----------


## daveyk021

> Post #38 (above) is really a nice version of the control.  It's fairly complex, but it is a single CTL file that you could just include in your project.


Tomorrow, I should have more time in the late afternoon, but I am trying it now.

How do I add a "user control" to a project?  I am working more in VBA, than VB6.  Adding it to VBA appears to be a slight issue.

Also, it is rather large.  When I tried to re-size it, the image clipped and I didn't see s stretch option.  I have one form with about 30 of them stacked on top of each other indication which test is running and the result.  Again, this is in VBA.  Also, this has just been a very quick attempt, so I am very new to your control.

I am sure, I will do a google here and find out.

Thanks kindly,

Dave

----------


## daveyk021

Okay, adding a user control in VB6 is easy.  Adding one to VBA is not possible and that is the majority of where I need them.

It's funny (well not really), the LED.OCX activeX control works fine with VBA on my Windows 11 Home machine, but not either one of my Windows 11 Pro machines.

The Windows 11 Home started out life as a Windows 10 Home machine and upgraded to Windows 11 Home.  That old LED.OCX control still works in that machine just fine.  It is an unregistered control, btw.  You just need to reference it in the IDE and you can you it.

It is a great control when it works.

----------


## OptionBase1

I haven't seen this mentioned yet, but could it just be that this particular .ocx file has dependencies that are simply missing on the machines it doesn't work on, but present on the machines it does?

----------


## Shaggy Hiker

This forum does not allow compiled code to be attached. Normally, that's not an issue, as people can just post the source code. Of course, in this case, that won't work, so if anybody would like the control to play around with, contact daveyk021.

----------


## dilettante

An OCX needs to be registered for the VB or VBA IDEs or an MS Office VBA host to use it.

If you browse to an OCX or DLL and select it as a referenced type library the IDE will silently perform the registration.  If the run of VB or the MS Office application is not elevated all sorts of problems can ensue.  Moving the OCX/DL around afterwar just leads to even more havoc.

For that matter a 32-bit OCX isn't normally usable from a 64-bit Office application, and that might be the real problem here.

Most of it boils down to MS Office issues, not VB issues.

----------


## Elroy

Yeah, regarding custom user controls, the VBA is an entirely different animal.

To resize things, there are properties on the properties window such that you can resize the LED circle and/or the font to whatever you want.  Then, once it's on a form, just copy-paste the one that's that size.

Regarding the VBA, you'd have to compile it as an OCX, and then register (or have installer do it for you) on the target machine.  When compiled, it does get registered during that process, but that's only on the machine it was compiled on.

And all of this sort of takes you back to the situation you were in when we started (getting an OCX correctly registered).  Sort of wish I'd known you wanted it for the VBA from the beginning, but I had fun with it, so no big deal.

----------


## Elroy

Also, just as an FYI, OCX controls won't work on the 64-bit version of the VBA (which is where everything is heading).  I'm wondering what this application is, and why you don't just get it going in VB6.  You can automate Word (or Excel, or PowerPoint, or Access) from VB6.  In fact, you can automate the 64-bit versions of any of the Office products from VB6 just fine.  (Automate = make Word or Excel or other do things you want.)

If it's some function you want while actually working in Word (or Excel, etc), those are actually better done in the VBA, which would be problematic.

----------


## Elroy

One last thought, now that we have more facts.

These other machines (on which LED.OCX won't work), is it the 64-bit version of MS-Office on them?  If so, that's ALL of your problem.

----------


## daveyk021

> An OCX needs to be registered for the VB or VBA IDEs or an MS Office VBA host to use it.
> 
> If you browse to an OCX or DLL and select it as a referenced type library the IDE will silently perform the registration.  If the run of VB or the MS Office application is not elevated all sorts of problems can ensue.  Moving the OCX/DL around afterwar just leads to even more havoc.
> 
> For that matter a 32-bit OCX isn't normally usable from a 64-bit Office application, and that might be the real problem here.
> 
> Most of it boils down to MS Office issues, not VB issues.



I would think so to, that it needs to register.  I went to my Windows 7 shop computer.  I can not register or unregister it on that machine, you get the same error as you do in Windows 11, yet it just works when it is referenced.  I do not understand this.  

What gets me is that is works on the Windows 11 Home machine, the same as it does under Windows 7.  It will not work on either Windows 11 Pro machines.  Grrrrrrrr

I will send it to you if you give me your email mail adr.

----------


## daveyk021

Attachment 185872

----------


## daveyk021

> One last thought, now that we have more facts.
> 
> These other machines (on which LED.OCX won't work), is it the 64-bit version of MS-Office on them?  If so, that's ALL of your problem.


Good thoughts.  I just checked, the Windows 11 Home has 32 bit Office 2016 and the Windows 11 Pro has 32bit Office 2016 too, same exact version.

By the way, I was wrong, it is mostly VB6 I need to get this working in.   Only one VBA program uses it and I can easily just remove it and would hardly notice.   The program with ~20 LEDS on its page is VB6.

Here is the log file when VB6 tries to load it:

     Line 28: Class LEDD.LED of control LED2 was not a loaded control class.
     Line 121: Class LEDD.LED of control LED1 was not a loaded control class.
     Line 297: Class LEDD.LED of control LED2 was not a loaded control class.


It is Visual Basic 6, 32 Bit, version 8176, 6.0.8169, Forms3: 16.0.14931.20

----------


## daveyk021

> One last thought, now that we have more facts.
> 
> These other machines (on which LED.OCX won't work), is it the 64-bit version of MS-Office on them?  If so, that's ALL of your problem.


Thinking I did not have the ocx service pack installed, I installed it.  VB6 shows the same version:

----------


## Elroy

You don't:



There were LOTS of bugs fixed through the years.  If you're not running SP6, you're just asking for trouble.

----------


## daveyk021

> You don't:
> 
> 
> 
> There were LOTS of bugs fixed through the years.  If you're not running SP6, you're just asking for trouble.


It said SP6 was installing but I guess not.  I uninstalled Visual studio and re-booted.  I am back to the issue where I cannot get my licensed copy to install under Windows 11 Pro:

----------


## Elroy

Since it is VB6 you'll be working in, get the SP6 for the VB6 IDE installed, and then throw that LedUserControl.ctl from post #38 into your project, and get on with it.   :Smilie: 

As you stated, you'll have a bit of patch-up to do in your code, but that LedUserControl.ctl is a solid piece of code.

And, to say again, resize your LED dot and font size while designing, and then it won't clip.  And, if you want several a certain size, just get one resized then copy-paste that control to wherever you want.  Each copy of the control will have its own properties, even if you do a control array.  But a copy-paste will copies that control's properties.

----------


## daveyk021

> Since it is VB6 you'll be working in, get the SP6 for the VB6 IDE installed, and then throw that LedUserControl.ctl from post #38 into your project, and get on with it.  
> 
> As you stated, you'll have a bit of patch-up to do in your code, but that LedUserControl.ctl is a solid piece of code.
> 
> And, to say again, resize your LED dot and font size while designing, and then it won't clip.  And, if you want several a certain size, just get one resized then copy-paste that control to wherever you want.  Each copy of the control will have its own properties, even if you do a control array.  But a copy-paste will copies that control's properties.


In trying to the SP to truly install, I am back to where I was when all this crap started a few weeks ago.  I can not get my copy of VB6 to install (after un-installing VB6).  The copy that did install came from a link on someone's video on how to get it to install in Windows 11.  That copy installed but would not take the service pack.

----------


## Elroy

Maybe *this will help*.  Be sure to read it carefully, especially the stuff about the msdatsrc.tlb.  That file often gets stuck sideways in our systems.  I don't have Win11, but I suspect pretty much all of it still applies.

----------


## daveyk021

> Maybe *this will help*.  Be sure to read it carefully, especially the stuff about the msdatsrc.tlb.  That file often gets stuck sideways in our systems.  I don't have Win11, but I suspect pretty much all of it still applies.


I'm trying, but it never makes it to the part where it asks for options to install.

----------


## Schmidt

> I'm trying, but it never makes it to the part where it asks for options to install.


Do you run your Setup-Executable via Right-Click->"Run as Administrator"?

Olaf

----------


## Eduardo-

> I'm trying, but it never makes it to the part where it asks for options to install.


https://www.vbforums.com/showthread....=1#post5579991

----------


## daveyk021

> Do you run your Setup-Executable via Right-Click->"Run as Administrator"?
> 
> Olaf


Yes, I can not get past this .

That comes after entering license key and selecting to install VB, instead of server components.

----------


## Elroy

Dave, you've got to give us a better image.  No way I can read that.  Maybe crop out the error and make a picture of just that.

----------


## daveyk021

> https://www.vbforums.com/showthread....=1#post5579991


Same issue, as soon as I click continue, I get Attachment 185883

Stopped for a few hours while we went to SAMS Club.  My original licenses copy of VB6 Pro will not install.

----------


## Eduardo-

> Same issue, as soon as I click continue, I get Attachment 185883
> 
> Stopped for a few hours while we went to SAMS Club.  My original licenses copy of VB6 Pro will not install.


I have no idea what you posted because the attachment doesn't work.

That procedure is working and has worked for years, I guess you are doing something wrong, perhaps seeing the image I could get a clue.

BTW: I just installed VB6 on Windows 11 22H2 two days ago.

----------


## daveyk021

> Dave, you've got to give us a better image.  No way I can read that.  Maybe crop out the error and make a picture of just that.

----------


## daveyk021

> I have no idea what you posted because the attachment doesn't work.
> 
> That procedure is working and has worked for years, I guess you are doing something wrong, perhaps seeing the image I could get a clue.
> 
> BTW: I just installed VB6 on Windows 11 22H2 two days ago.


This is Windows 11 Pro 21H2

----------


## Eduardo-

> 


OK, the step that must have been missing is:




> First execute SETUP.EXE normally until you see the error. If it ask to restart, do it and run again.
> Then, from the SETUP folder, copy VS98ENT.STF as acmsetup.stf (or it may be VB98ENT.STF).
> Execute ACMSETUP.EXE as admin.


or:




> First execute SETUP.EXE normally until you see the error. If it ask to restart, do it and run again.
> Then, from the SETUP folder, copy VS98ENT.STF as acmsetup.stf (or it may be VB98ENT.STF).
> Execute ACMSETUP.EXE as admin.


or both.

----------


## Eduardo-

> This is Windows 11 Pro 21H2


I have installed VB6 in Windows 11 Pro 21H2, also in current 22H2 and on several Windows 10, and Windows 7 64 bits.

----------


## daveyk021

> OK, the step that must have been missing is:
> 
> 
> 
> or:
> 
> 
> 
> or both.



When I do that, ACMSetup tells me it can not find Setup.ini, etc...  In the root install folder, there is no AcmSetup.EXE, so I assume you must be meaning to run it in the Setup folder.

I've uninstalled everything that it had installed in the past, except the SP Update, which never took, it will not allow that to be un-installed.  I've edited the registry to remove all it's remembrance of VB6.   Waiting for a Windows update to finish installing, then it will re-boot, and I can try this again.

----------


## daveyk021

Oh, and I was wrong about one other thing.  This machine started out as Windows 10 Pro and upgraded to Windows 11 Pro.   The other one I worked with and gave up on started out as Windows 11 Pro.

The one that is working without issue is the HP that started out as Windows 10 Home, and HP hooked up and got it upgraded to Windows 11 Home, as it was supposed to have come.  That one, VB6, VBA works without any issues.

Worse case, later, this week, I will order another SSD hard drive (M.2) and buy a Windows 11 Home License, on VIPKeys, for that strip and swap it out as an experiment.  The problem is I have so much licenses software and utilities, that even though it is the same machine, I loose an install license and that's a pain in the ass.  It's a pain to start over, but I may do that as an experiment.

A Windows 11 update is about 75% installed.  I am letting it go an then a re-boot and try again.

I had no issues under Windows 10 doing this, but it was always Windows 10 Home.  I can't help but feel there is something in "Pro" that is blocking its install.

----------


## Eduardo-

> When I do that, ACMSetup tells me it can not find Setup.ini, etc...  In the root install folder, there is no AcmSetup.EXE, so I assume you must be meaning to run it in the Setup folder.


Yes, in the setup folder.

From the SETUP folder, copy VS98ENT.STF as acmsetup.stf (or it may be VB98ENT.STF).
Then:
Execute ACMSETUP.EXE as admin.




> I've uninstalled everything that it had installed in the past, except the SP Update, which never took, it will not allow that to be un-installed.  I've edited the registry to remove all it's remembrance of VB6.   Waiting for a Windows update to finish installing, then it will re-boot, and I can try this again.


Forget about other things, try to concentrate in doing right something that I'm telling you it works.

----------


## daveyk021

> Yes, in the setup folder.
> 
> From the SETUP folder, copy VS98ENT.STF as acmsetup.stf (or it may be VB98ENT.STF).
> Then:
> Execute ACMSETUP.EXE as admin.
> 
> Forget about other things, try to concentrate in doing right something that I'm telling you it works.



Done that and it will not install.  I am giving up for now.  My Windows 7 machine will have to run the bench until I get back to this.  The Windows 11 Home system that VB6 and VBA is working perfect is not a bench computer.  It is an all-in-one and not really a performer; not that it has to be, but currently it is running as an environmental data logger on a file cabinet - lol.

I think I am ordering an M.2 now (should have in two days) and a Windows 11 Home license and give that a try.  I mean, I am pulling my hair out.  I have two Windows 11 Pro machines that absolutely won't work and on this one, since un-installing VB6, it refuses to install again.  Then there is that silly all-in-one running Windows 11 Home that Everything is working fine on.  I have no idea why.

----------


## daveyk021

> You don't:
> 
> 
> 
> There were LOTS of bugs fixed through the years.  If you're not running SP6, you're just asking for trouble.


Hello Elroy,

I stumbled with acmsetup added the files and folders as need and got VB6 Installed again on this bench computer.

When I try to install the SP6 service pack, I am getting this:


If it isn't one thing, it's another.  I will be happy to use the LED user control from a message way back, but got to get SP6 installed. ...and yes, I rebooted several times.  Since the update in an .msi file, you do not get the opportunity to run it as an adminn

----------


## daveyk021

I found a very old version of the SP6, on my network, that was a folder of files, rather than an MSI files, and it installed.

Attachment 185886



So that is now done.  Good Lord, why is it this hard?! lol

----------


## daveyk021

Hello Elroy,

It looks like the minimal height it 375 for the control.  Is there a way to shrink it so it looks good in 255?

Dave

----------


## Elroy

Hi Dave,

Just set the *LedSize* property to whatever size you want while in design-mode.

Here it is at 100:



You can also change it at run-time, but you probably want to take care of all this sizing while designing.

----------


## Elroy

Here, this is my very latest version of the thing.  I forget if this is what I last posted or not, but here it is:

----------


## daveyk021

Ahhh!!! Wonderful!!  I missed that, but my eyes are really burning right now.  I was looking for size and my eyes never settled on LEDSIZE - lol.

I also need to read the link, way back when, you left for designing user controls.  I have loaded your control in VB6 in design mode and do not see how you are making the round LED (which is PERFECT by the way).  The form associated with it just looks like a large form with a time control on it and no drawing of the LED.  I started to look at the code behind the user control and my head started throbbing.  I will look at it further tomorrow.

Hopefully, I can link a bunch of them together as a control array and assign each one its own index value.

----------


## Elroy

Ahhh, yeah, I left you messages about how to get started with User-Controls.  Both Eduardo and I sort of got carried away with this thing.

The latest version is using a Windows graphing library called GDI+, which does a _very_ nice job of drawing things.  However, it's fairly advanced to use.  In this latest version, that's what's being used to draw both the LED dot and the border around it.  The fact that it's done with GDI+ is why it looks so nice.

If you want to start learning about User-Control, my *post #18* is a much better starting place.  That version of the control uses standard VB6 drawing objects and a label control on the custom User-Control ... and it's _far_ less code in it.  I don't think it even has any API calls in it.

It works fine, it's just not nearly as "pretty" as the latest version.

----------


## dilettante

I doubt that "Cumulative Update for SP6" is SP6 itself.

Worse yet, it sounds like the thing they also called "Security Rollup" that actually broke a lot of controls, inserting off-by-one errors in many places that could cause program crashes and data corruption.  The security issues it was meant to address only mattered for OCXs for deployment _as part of IE web pages_ anyway.

I can't even find a Microsoft download for SP6 any more.  The newest one that I have here is Vs6sp6d.exe and that may have been the last one.

----------


## OptionBase1

> Hello Elroy,
> 
> I stumbled with acmsetup added the files and folders as need and got VB6 Installed again on this bench computer.
> 
> When I try to install the SP6 service pack, I am getting this:


That message indicates that what you were trying to install at that point was not VB 6.0 SP6, but instead, a cumulative update for devices already running VB 6.0 SP6.  I see you posted below that you found the actual SP6 and got that installed, but I wanted to mention this for your own sake and for anyone else down the road that might be reading this.

----------


## daveyk021

A little anomaly I found, maybe you can splain.  Here I added two control, each with a different index.  Looks fantastice:
Attachment 185890

I move the control and it goes blank unless I resize it:
Attachment 185891

----------


## Elroy

I just looked and I forgot to put a "Caption" property in that post #18 version (to change the label's caption), but it might be a good exercise for you to figure out how to do that.

Basically, a Public Get and Public Let Property named Caption, set the Label's caption with the incoming Public Let's argument.  And then also read & write them to the control's property bag.

I'm willing to just continue on with this thread if you'd like to try and understand user-controls more.  Personally, I think they're fun.   :Smilie:

----------


## Elroy

> A little anomaly I found, maybe you can splain.  Here I added two control, each with a different index.  Looks fantastice:
> Attachment 185890
> 
> I move the control and it goes blank unless I resize it:
> Attachment 185891


Dave, these forums have a bug regarding attaching pictures.  You have to go to "Go Advanced" (before posting) for it to always work correctly.  And I can't see your pictures.

----------


## Elroy

Also, it's always best to save your pictures as PNG files if you can do that.  JPGs also work, but PNGs are better.

----------


## Elroy

Ahhh, I figured it out from your notes.

Upon runtime, it all works fine ... so there's that.

When you move the control, it's just not getting a refresh during design-time.  If you close-and-reopen the form, that also fixes it.

I'll look at it though.  Without doing subclassing, I'm not positive I can detect those moves though.  Also, I disabled the blinking during design-time.  If I enabled that, that'd also fix it.

----------


## daveyk021

> Dave, these forums have a bug regarding attaching pictures.  You have to go to "Go Advanced" (before posting) for it to always work correctly.  And I can't see your pictures.






If I change any parameter of the control, it comes back.  If I move the control, it looks like it does in the second picture.

----------


## daveyk021

What I can do is leave the background color different than the form.  That way, I can always see where the LED is at.  Then during the load event, change the background color to match the form background.

I do not think it will take me that long to adapt the programs that use it to your user control.  It is still funny that in the "home" machine, the old .ocx control works perfect.  Well, I can not waste any more energy in trying to figure that out.  It is what it is and your control is most probably a lot more powerful.

BTW, good night, I must head upstairs to the TV and what not.

Dave

----------


## Elroy

I fixed it.  No subclassing needed.  Just the following line in the Repaint event:



```

    mbFullRefresh = mbFullRefresh Or Not RunTime


```

New version attached.

LedUserControl.zip

----------


## daveyk021

Yes, it is fixed!! Perfect.  Now I must head up; thank you so kindly, and good night.

----------


## Elroy

> What I can do is leave the background color different than the form.  That way, I can always see where the LED is at.


I think that's a good idea.




> I do not think it will take me that long to adapt the programs that use it to your user control.


Good to hear.   :Smilie: 




> It is still funny that in the "home" machine, the old .ocx control works perfect.


Personally, I think it's better to have all the source code to everything, and have it all in one project (if possible).




> BTW, good night, I must head upstairs to the TV and what not.


Have a nice evening.   :Smilie:

----------


## daveyk021

Good morning Elroy,

I will put an image of my finished form with your control when I have it updated.

The hard of an array in Frame container is that I can not copy Paste as VB6 will not link them then even if I rename the control and set the correct index, plus it disappears in the frame.  So, I must add the control and then do all the color and size changes, index change, and everything else.  I wish I could just paste, change the index and caption.

Anyway, working on it a bit now, then I must get to doing some real paying work in the shop.

Dave

----------


## Elroy

Good morning Dave,

Well, another option is to edit the code of the custom UC (being sure to close your other forms first), and edit the defaults.

Here's the code you'd edit:



```
Private Sub UserControl_InitProperties()
    mnLedSize = 300!
    mlState = Blinking
    mlBlinkRate = 1000&
    mlBackColor = vbButtonFace
    mlBackStyle = vbTransparent
    mlBorderColor = vbBlack
    msCaption = "Caption"
    mlLedColor = vbRed
    mlBorderWidth = 1&
    mbThreeD = True
End Sub
```

Changing any of those would change the initial values of things when placing a new control on your form.

----------


## Elroy

And the Font is a bit different.  If you wish to change the default caption font, just open the UC's designer form (closing other forms first), and then change the font of the UC's designer form.  That's where the font is stored for this UC (to be used for the caption).

----------


## Elroy

You may ask why I keep saying to "close other forms first".  If you simultaneously have a form open that has a custom UC on it, and also have that custom UC open for editing, the IDE sometimes gets confused and changes all those custom UCs on the other form to PictureBoxes.  If your other forms are just sitting in the Project Window (unopened), this never happens.

And this sort of makes sense, considering all the things the Intellisense is trying to do (show you all the properties and methods of everything).

----------


## daveyk021

I do see that there is not an "Enable" parameter.  That is not a big deal, but I typically, in the load event, or by default, have the LED not enabled, until after the program has made the serial connection to the instrument under test.

So the form comes up, you can see all the controls, but they are all disabled except for the the Serial Communication Port pull-down.  Once a connection to the instrument under test, has been established, all controls are enabled. Typically that is done to any control with a given TAG.

----------


## Elroy

Ahhh, ok, I'll add that.  Give me a few minutes.   :Smilie: 

I'm going to disallow blinking if it's disabled, and I'm also going to add other new properties:  Disabled-LED-Color & Disabled-Caption-Color.  I'll just use light gray for those defaults.

Also, if you tell me what you'd like for the size defaults, I'll change those too.

----------


## daveyk021

Here is what the LED portion of my test screen looks like:


At one point, and I have not been able to duplicate, I moved the frame, and all the controls "hashed out".

As far as the enable, I easily take care of that with a global ControlsEnable Boolean variable. So don't worry about it.

----------


## daveyk021

> Ahhh, ok, I'll add that.  Give me a few minutes.  
> 
> I'm going to disallow blinking if it's disabled, and I'm also going to add other new properties:  Disabled-LED-Color & Disabled-Caption-Color.  I'll just use light gray for those defaults.
> 
> Also, if you tell me what you'd like for the size defaults, I'll change those too.


Too cool; thank you.  Light grey disabled is grey.  Defaults?  I seen to like a boarder size of 2, size 200.  I'm not sure of color.  I have these at yellow, but, I will probably change that to clear, then during a test, blink yellow, after test, if the test passes, it will be solid green or solid red if the test fails.

Dude, you really came up with something great here.  You should sell this!  I need to compensate you.  In my shop it is just me and these control and test programs I write make my life easier.  I plan to keep the shop going for at least two and a half years yet, before going full hobby.  Life gets shorter and shorter, I probably should quit when I'm 64.5.  Right now, it is still fun!   I'm not sure if they make me more efficient, or give me more time to watch YouTube when I should be working - lol.  

Let me know your email.

----------


## daveyk021

I guess not "clear" as such but to the form background color.

----------


## daveyk021

Okay, it hashes out once I go to your control to look at all the options


I'm not sure what it take to un-hash them.

----------


## Elroy

Ok, working on it.  Another few minutes.

----------


## Elroy

Ok, here's the lastest.

Here's what I've done:
Added an "Enabled" property.Added a "CaptionDisabledColor" property.Added a "LedDisabledColor" property.Added a "LedOffColor" property.Changed "BorderWidth" property's new default value to 2.Changed "LedSize" property's new default to 200.Changed "LedColor" property's new default to vbYellow.
Ok, you also mentioned the BackColor property, and maybe having a transparent option.  That's not as totally easy as it might seem.  The reason is that I don't necessarily know the container's back-color until runtime.  So, here's what I can do.  I can give you a Transparent property, but it will only work during runtime.  Would you like that?

And, a related question.  When the LED is blinking, but off, should it also use that container's back-color?  Or should it stick with it's own LedOffColor?  Or, should I have another "LedBackStyle" property (opaque/transparent) that determines that?

Work attached.

p.s.  No payment needed.  I'm a 70yo retired guy who just enjoys trying to keep my mind sharp.  I don't mind giving you my email though, but I'd rather just stick with this thread regarding this LED work.

----------


## Elroy

> Okay, it hashes out once I go to your control to look at all the options
> 
> 
> I'm not sure what it take to un-hash them.


Ok, that's why I keep saying to close your regular form before messing with the UC's code (or designer form).  When it does that, just close that form, close the UC stuff, and then re-open the form ... and you're usually ok.

----------


## Eduardo-

> having a transparent option


UserControl:

BackStyle = 0
ClipBehavior = 0



```
Private Sub UserControl_HitTest(X As Single, Y As Single, HitResult As Integer)
    HitResult = vbHitResultHit
End Sub
```

----------


## Elroy

Ok, I've added two more properties:

ControlBackStyleLedOffStyle
Both have two options, Transparent or Opaque.

If ControlBackStyle is Opaque it used the BackColor property.  If ControlBackStyle is translucent, it uses the UC container's BackColor property.

The LedOffStyle is a bit trickier.  Here's the Select Case statement for what it does:



```

            Select Case True
            Case mlLedOffStyle = styleOpaque:       iFillColor = mlLedOffColor
            Case mlControlBackStyle = styleOpaque:  iFillColor = mlBackColor
            Case Else:                              iFillColor = Ambient.BackColor
            End Select


```

That only executes when the LED is off (but not disabled), such as blinking off, or just turned off.  Otherwise it's filled with the LedColor value.

Work attached.

Eduardo: I just vertically center both the LED and the caption, so I don't really worry about clipping.  And also, the caption wraps, so horizontal clipping doesn't really make sense.  Regarding vertical clipping, I suppose I could monitor changes to both the LED and the caption's font, and resize accordingly, but the caption wrapping would make even that difficult.  That caption just complicates auto-sizing, and that's why I just didn't bother with it.  Just let him work it our during designing.

----------


## Eduardo-



----------


## Eduardo-

I mean, "transparent" being transparent.

----------


## Elroy

> I mean, "transparent" being transparent.


Ahhh, yeah, that's another level.  I believe you're using "regions" to get that done.  Again, with the caption, that gets rather complex.  I'll let Davey ask for that before I throw myself into that one.

----------


## Eduardo-

> Ahhh, yeah, that's another level.  I believe you're using "regions" to get that done.  Again, with the caption, that gets rather complex.  I'll let Davey ask for that before I throw myself into that one.


No, the whole control is the region, like it is now.

----------


## Elroy

> No, the whole control is the region, like it is now.


Well, that was easy enough.  I saw the commented out lines, and the new lines.

Dave, not sure you'll use it, but Eduardo has given you the ability for a more true transparency, in the case where your container has a picture in its background.

He used my latest code and patched it up, so it's got all of my latest changes.  I've taken his work and I'm calling it the "latest".

----------


## Elroy

Ok, one more change.

If both ControlBackStyle=transparent, and LedBackStyle=transparent, you now get the picture in the center of the LED, as it should be.

The new Select Case for that (when the LED light isn't shining):



```

            Select Case True
            Case mlLedOffStyle = styleOpaque:       iFillColor = mlLedOffColor
            Case mlControlBackStyle = styleOpaque:  iFillColor = mlBackColor
            Case Else:                              iFilled = False
            End Select


```

Work attached (including Eduardo's mod):

----------


## Elroy

Dave,

Just as an FYI, I know you're trying to get some design work done.

For ALL of these recent changes, to implement them, all you have to do is to open the UC's code window, delete all the code, and then paste the code from the latest version.  (Again, closing all your other forms when you do this.)

But, done this way, all the changes will just automatically appear on all your design work with this UC.

----------


## Eduardo-

Yes, but there was an issue in the first version that I posted, I fixed that soon but you had already downloaded.
The issue is that the control is not painted at runtime until it blinks.

Here is your latest version but with the fix.

----------


## Elroy

> Yes, but there was an issue in the first version that I posted, I fixed that soon but you had already downloaded.
> The issue is that the control is not painted at runtime until it blinks.
> 
> Here is your latest version but with the fix.


Ahhh, perfect.  You just moved it up to where the property is changed.   :Smilie: 

Davey, you keeping up?   :Stick Out Tongue: 

Also, I've got to run some errands.  I'll almost certainly check in later.

----------


## Eduardo-

BTW, JFYI, with the HitTest event you could just make the hit when the user clicks on the LED if you want.

----------


## daveyk021

Beautiful background!

----------


## daveyk021

> Ahhh, yeah, that's another level.  I believe you're using "regions" to get that done.  Again, with the caption, that gets rather complex.  I'll let Davey ask for that before I throw myself into that one.


Naa, that's okay; I am thrilled with what you did!!!  THANK YOU!!   The compiled program is running.

I must say my program is running a lor fast on this new Windows 11 I5- 12600KF processor (~4GHz) than is does on my Windows 7 I7 at 2.7GHz.

This LED issue was one of the reasons I never adopted Windows 10 for the bench.  The major one was MSCOMM32.OCX would not work.  I guess sometime after Windows 10 was out, it was patched and MSCOMM32 worked again.  I just found that out last week or so - LOL.  I still hate Windows 10.  I really like Windows 11, with the exception of when my cursor ventures near the lower left and that stupid "Current Events/Weather" window pops up.  A few curses gets it to close.  I will search on how to disable that.  Other than that and that VB6 is a real pain in the butt to get installed, I think Windows 11 may become my favorite operating system yet.

I do have a program I did not write that is very old, from the Windows 2000 days, that works fine under Windows 7, but not under 11.  I need to use it occasionally.  So I will need to keep the Windows 7 system on the bench and updated.  I should investigate if I can add a virtual machine to Windows 11 and install Windows 7 on it, or even XP (I have licenses for both). ....but not today.

Now, I wish I could could add User Controls to VBA under Access (Office 2016).  So far, I could not figure out how.  I think, I only have one program using the LED and it's just for cool looks, and not used as "buttons" like this VB6 program.  I just deleted it and remarked out the code.  Your LED is so damn nice, I would love to use it in VBA program updates.  My most intense test software, the uses VISA code (GPIB) to control and get data from my test equipment while controlling the instrument under test via serial.  I did all that programming under Access for the ease of database'ing the data and creating the professions elegant reports.  With VB6, I am putting the data out in a .dat file and then using Excel to read the data in and with VBA, creating the reports using a template file and a lot of code to format that report.  A major pain in the ass but with good results. Access reports are visually easier to make but still can take a lot of time and the formatting is easier.  What's nice with Access a number of my reports end up being self-modifying to an extent, re-arranging themselves based on what they are meant to do.

Anywho, if you do any work in VBA under Office and know how to add this User control, let me know, but it is not urgent or really needed, but would be too cool.

Dave

----------


## Elroy

> Anywho, if you do any work in VBA under Office and know how to add this User control, let me know, but it is not urgent or really needed, but would be too cool.


Here, I've reconfigured the latest version.  I'll outline what I did.

Copy the LedUserControl.ctl to LedUserControlToOcx.ctlEdit this new LedUserControlToOcx.ctl with Notepad (actually NP++) and changed the line from *Attribute VB_Exposed = False* to *Attribute VB_Exposed = True*, and saved.Started a new project, and changed its project properties to *Project Type: ActiveX Control*, and *Startup Object: (none)*Also named it LedUserControlToOcx, and test-compiled the OCX, also naming it *LedUserControlToOcx.ocx*
We're not allowed to post executables here (with good reason), but attached is this reconfigured project.  All you have to do is compile it: *File/Make LedUserControlToOcx.ocx*

It'll write out an OCX, an EXP, a LIB, and a OCA file.  You can delete all but the OCX, as that's all you need.  (But don't delete the CTL or VBP, as that's your source code.)

That OCX will immediately be registered on the machine on which it was compiled.  That's part of the compiling process.  However, if copied to another computer, it'll need to be re-registered (easiest with RegSvr32, which is on almost all machines).  Just get a command prompt, navigate to the folder where you've placed this OCX, and type in:  _RegSvr32 LedUserControlToOcx.ocx_

(If you move this OCX file, you'll need to re-register it.)

After it's registered, it will appear in the Project/Components.  You can include it as a component and it will appear in your ToolBox.  _This is true of both VB6 and the 32-bit VBA_.  Regarding any 64-bit VBA, you're SOL.

(I actually can't test the 32-bit version of the VBA, as I've only got MS-Office 64-bit these days.  But it should work just fine.  The 64-bit version doesn't even give you any way to add components at all.)

Enjoy

ADDED:  As a last comment, sooo many people have problems getting these OCX files registered.  That's why, in the beginning, I advocated for just having your custom UC in with your main project's source code.  However, you can't do this with the VBA (not even the 32-bit version).  But you can with VB6, which is what you've been doing.

REMOVED ATTACHMENT:  Go get the one from post #129, as the one I had here had a bug.

----------


## Eduardo-

You left the last bug.

----------


## Elroy

> You left the last bug.


Oh crud.  Ok, I'll fix it.

----------


## Elroy

Ok, what am I missing?  Eduardo, I pulled the code from your post #118, and that's what's in the above OCX project.  I even just did a file-compare, and there were no differences, other than the "Exposed" property.

----------


## Eduardo-

> Ok, what am I missing?  Eduardo, I pulled the code from your post #118, and that's what's in the above OCX project.  I even just did a file-compare, and there were no differences, other than the "Exposed" property.


That's not the code from post #118, I guess it must be from post #114.

At run time the control does not show up until it blinks.

----------


## Elroy

Ok, you're right.  I just downloaded post #118 and post #123, and they're different.

Sorry, I'll fix it.

----------


## Elroy

Ok ok.   :Smilie: 

Here's the latest version, setup to compile as an OCX (as per discussed in post #123).

----------


## daveyk021

Well I was able to compile it. I got an error unable to access registry, but I copied it to syswow64 and manually registered it.

Under access it shows up as an active x control.  When I add it to an existing form, it is huge, so I manually resized it much smaller.  Looks good in design mode.  With no code, and the caption changed to "What's up Doc?", in form view mode,  it's invisible.  So in edit mode, I gave it a boarder.  The boarder shows up in form view mode, but that's it.

----------


## Elroy

> Well I was able to compile it. I got an error unable to access registry, but I copied it to syswow64 and manually registered it.
> 
> Under access it shows up as an active x control.  When I add it to an existing form, it is huge, so I manually resized it much smaller.  Looks good in design mode.  With no code, and the caption changed to "What's up Doc?", in form view mode,  it's invisible.  So in edit mode, I gave it a boarder.  The boarder shows up in form view mode, but that's it.


Hmmm, sorry, I'm not able to test (not having a 32-bit version of MS-Office installed anywhere).

In the past years, I've done a _lot_ of work in the VBA.  However, I've moved almost all of that work into VB6, and do what I need with Word or Excel via "automation" from VB6.  To me, it's just cleaner that way, well, at least for what I'm typically doing.  And, VB6 automates 64-bit version of MS-Office programs just fine.

----------


## daveyk021

> Hmmm, sorry, I'm not able to test (not having a 32-bit version of MS-Office installed anywhere).
> 
> In the past years, I've done a _lot_ of work in the VBA.  However, I've moved almost all of that work into VB6, and do what I need with Word or Excel via "automation" from VB6.  To me, it's just cleaner that way, well, at least for what I'm typically doing.  And, VB6 automates 64-bit version of MS-Office programs just fine.


When I got my license for Office 2016, it just came as 32 bit, which is good because it is what I am used to and didn't need hassles and any work arounds.  I know I tried Office 2019 and it worked but was a real pain because every database/program needed  some large version detection added and large groups of variable re-defines based on what version of office it running under.  I had one program running in both Office 2016 (and 2010) and 2019, but it was a lot work and a lot more code.  Now, I do not remember if that 2019 was 64 bit, but I don't think that was issue.

Last night, I had to revert this system back to Windows 11 version 21H2, based on Microsoft's recommendation of giving "22H2 several months to mature" - this was a real message from Microsoft in their Windows 11 support forum on Microsoft.com.  They know they have issues with it.  That is why it shows up as an optional update and not on all Windows 11 machines.   I had found out that Keysight's IO Library Suite Could not install or repair, or modify under 22H2.  I wasted hours on that.  I followed Microsoft's recommendation and then all things VISA/Keysight started working again. Another thing, for me, that stopped working after the update was the Compatibility Trouble-shooter.  I had to install VB6 and SP6 again.   It was still a pain, but at least time, I knew what to do to get it to install.  The system seems solid again this morning.

So that fun set me back a little.  I just had to re-register LEDUserToOCX.OCX again.  Still not showing in Access 2016/32, BUT I have not tried to make it blink or anything yet, although it is set to blink under parameters.  I will play with it a little more when I get a chance.  This morning, I am getting an instrument out of here first 8-).

Dave

----------


## daveyk021

> Hmmm, sorry, I'm not able to test (not having a 32-bit version of MS-Office installed anywhere).
> 
> In the past years, I've done a _lot_ of work in the VBA.  However, I've moved almost all of that work into VB6, and do what I need with Word or Excel via "automation" from VB6.  To me, it's just cleaner that way, well, at least for what I'm typically doing.  And, VB6 automates 64-bit version of MS-Office programs just fine.


One more problem.  When I went to print a report, I was receiving an "Undefined Trim Function" error.  The report does not use the control, in fact I deleted it from the form.  I tried numerous things.  Once I unreferenced LEDUserToOCX.OCX in the IDE, the Trim error went away.

Dave

----------


## Elroy

> One more problem.  When I went to print a report, I was receiving an "Undefined Trim Function" error.  The report does not use the control, in fact I deleted it from the form.  I tried numerous things.  Once I unreferenced LEDUserToOCX.OCX in the IDE, the Trim error went away.
> 
> Dave


Are we talking about the VBA or VB6?

In either case, we really need to see the line of code (and some surrounding code) of the error before we could diagnose anything.

----------


## daveyk021

> Are we talking about the VBA or VB6?
> 
> In either case, we really need to see the line of code (and some surrounding code) of the error before we could diagnose anything.


VBA (Access 2016 / 32).  As for the line, I don't know, I couldn't get that far.  I wasn't using an LEDUserToOCX control anywhere, I just had it referenced in the IDE.  As soon as I removed the reference, the database program (specifically report) started running again.

----------


## Elroy

Dave, just as an FYI, I'll be out-of-pocket for a few days (going to Vegas for a few days).  Also, maybe someone else will jump in and maybe help with getting it going in the VBA.  I'll be back next week, and almost certainly check around VbForums.  

Best of Luck,
Elroy

----------


## daveyk021

Hope you trip to LV was fun.  This is just a follow up.

Your LEDUserControl has been working perfect in my major VB6 project.

I still have not gotten it to work in VBA, but I am not too worried about that.

Thank you, again !!!

----------


## Elroy

> Hope you trip to LV was fun.  This is just a follow up.
> 
> Your LEDUserControl has been working perfect in my major VB6 project.
> 
> I still have not gotten it to work in VBA, but I am not too worried about that.
> 
> Thank you, again !!!


No problem, and yeah Las Vegas was fun.  We were just there for 4 days.  We're now out camping this weekend, catching some Autumn colors in the Smokey Mountains.

----------


## dilettante

> This LED issue was one of the reasons I never adopted Windows 10 for the bench.  The major one was MSCOMM32.OCX would not work.  I guess sometime after Windows 10 was out, it was patched and MSCOMM32 worked again.


MSCOMM32.OCX has not had a major problem in a very long time, and was more or less set in stone aside from occasional minor security patches.  Even the one I have installed now has a file creation date in 1998.

It has been working in Windows 11, Windows 10 all the way back to its beginning, Windows Vista, and probably Windows 7, Windows 8, and Windows 8.1 though I never tested it there.


I have no doubt that you might have run into issues with it, but I seriously doubt it had anything to do with this OCX itself.

----------


## daveyk021

When Windows 10 first came out, we could get nothing that used the serial port to run.  Nothing based on MSCOMM32.OCX that is.  I never looked back in to using it again.  Now that Windows 10 has had updates, it works fine again, and yes, it is working very well in Windows 11.  SCOMM32.OCX works too, but I really don't see a need to use it, although on event driven communications, I think its event codes are more accurate.   I dunno, I just went back to using MSCOMM32.  It would be nice if it allowed 115K.  I'll have to check if SCOMM32 does, but I don't think so.

----------


## daveyk021

Elroy,

I have been using your LEDUSerControl with success these last few months, but it can be somewhat delicate to changes in the VB6 IDE environment.

By that I mean, that it seems if I add another ActiveX control, i.e., "Microsoft Windows Common Controls 6.0 (SP6)", the LEDs go away and turn in to to just hash marks on the forms.

Any idea how to restore them?  It is a LOT of work on some of my forms to re-add them again.  Yep, they can be re-added, but the existing LEDS are gone.

Thanks much,

Dave

----------


## Elroy

> Elroy,
> 
> I have been using your LEDUSerControl with success these last few months, but it can be somewhat delicate to changes in the VB6 IDE environment.
> 
> By that I mean, that it seems if I add another ActiveX control, i.e., "Microsoft Windows Common Controls 6.0 (SP6)", the LEDs go away and turn in to to just hash marks on the forms.
> 
> Any idea how to restore them?  It is a LOT of work on some of my forms to re-add them again.  Yep, they can be re-added, but the existing LEDS are gone.
> 
> Thanks much,
> ...


Dave, that's a problem with any/all custom user controls.  There are a couple of solutions: 1) compile the LED UC into its own OCX file, and then pull that into your project via components; or 2) while developing just be sure to not open the actual UCs windows in the IDE, not its form designer window nor its code window.  If you don't open the UC's windows, you shouldn't have that problem.

ADDED:  On that last point, if you need to open the UC's windows, just be sure any form that's using the UC is closed first in the IDE.  And, when you're done doing whatever to the UC, be sure to close its windows before opening any form that's using it.  Taking that approach usually circumvents any problems like you describe.  I suspect that those of us who make regular use of UCs have just learned these habits.

----------

