X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Using ActiveX Controls on Windows 7, Any Version    
Peter Hibbs
post Jul 30 2010, 04:40 PM

UtterAccess VIP
Posts: 1,767
Joined: 17-June 10
From: Dorset. UK.

When installing an ActiveX control on a computer with the 64 bit version of Windows 7 as the Operating System, the procedure is slightly different to the method used in earlier versions.
This note describes how to install the 32 bit MSFLXGRD.OCX ActiveX control for use in an Access database but it is probably much the same for any 32 bit ActiveX control.
In the 64 bit version of Windows 7, the System32 folder (C:\WINDOWS\System32) is now used to store all the 64 bit library files that are required by Windows. To maintain compatibility with older programs, the 32 bit library files have now been moved to a new folder called sysWOW64 which is also in the C:\WINDOWS folder (confusing I know). To register an ActiveX control the executable file, regsvr32.exe, is normally used to register the control but now there are two versions of this program, one for the new 64 bit library files in the system32 folder and the original 32 bit version is now in the sysWOW64 folder.
This all means that to use an older 32 bit ActiveX control on Windows 7, the control's file should be copied into the sysWOW64 folder and registered using the regsvr32.exe program in the same folder. The problem here is that when using the Run Command, Windows normally uses the 64 bit version of regsvr32.exe which will then fail since it cannot find the control, so you need to define the folder name as well as the program name in the Run Command window when registering a control.
For example, the procedure to install the FlexGrid ActiveX control on Windows 7 would be something like this :-
1. Disable UAC temporarily because this procedure will be making changes to the registry.
To do this go to the Control Panel -> User Accounts. Click on Change User Account Control Setting, set slider to Never Notify (make a note of the current setting so that you can restore it later), click OK and then reboot the PC for it to take effect. See here for more info.
2. Copy the 32 bit ActiveX control file (MSFLXGRD.OCX or whatever) into the folder C:\WINDOWS\sysWOW64.
3. To register the control click Start -> Run, enter "C:\WINDOWS\sysWOW64\regsvr32.exe MSFLXGRD.OCX" (only without the quotes) and click OK. You should then see the message "DllRegisterServer in msflxgrd.ocx succeeded". Close the window.
4. You should now be able to run the database as normal.
For Access 2003 (or earlier) programs you may get a security error message which you can skip. To disable the message for future use, see here.
For Access 2007 (and presumably A2010) you will need to install the database in a 'Trusted Location' and probably have to change some security settings. See here for more information.
5. Restore the UAC setting to its original setting.
To register the control using VBA code you can use the sub-routine shown below. First create a new code module and save it as modActiveXRegister (or whatever name you like) and copy the code below into it. To register the control you can just call the RegisterFlexGrid procedure from your start up code.

Declare Function DllRegisterServer Lib "C:\WINDOWS\sysWOW64\MSFLXGRD.OCX" () As Long
Public Sub RegisterFlexGrid()
'To register your DLL (or OCX) use this function
On Error GoTo ErrorCode
If DllRegisterServer = ERROR_SUCCESS Then
MsgBox "Registration was Successful"
MsgBox "Registration was Unsuccessful"
End If
Exit Sub
MsgBox Err.Description
End Sub

Note however, that I have not tested this code on Windows 7 (it works on Windows XP though) so I am not sure if you need to turn off the UAC first (but I guess you would). You use this routine at your own risk.
If anyone can add any other useful information to this post regarding ActiveX controls on Windows 7 then I would be interested to hear it.
Peter Hibbs.
Go to the top of the page

Posts in this topic

Custom Search

RSSSearch   Top   Lo-Fi    18th February 2020 - 08:36 PM