1) The error VFP reports is as follows:
"OLE error code 0x800040154: Class not registered".
2) The setup
My work computer is a single physical machine running 64-bit Windows 7: however, it has a virtual PC running 32-bit Windows XP too. The VFP code works on the WinXP virtual machine but not on the Win7 machine itself.
Also, although it probably doesn't matter at all, I use Remote Desktop to connect to my work computer.
3) The VFP code is as follows:
The line that throws the error - when run on the Win7 machine itself, but not when run on the virtual WinXP machine - is the ADDOBJECT() call.
4) Solution is simple, right?
The straightforward solution to a "Class Not Registered" error is to register the class. I have done so:
C:\Windows\System32>regsvr32.exe "<path and .ocx file name>"
and I receive a success message when I do. But the problem remains.
5) Class is registered
The class is registered: that is, I can find it in the Registry. Also, I may be wronb but I believe that if a truly unregistered class were referenced that the error would be "Invalid class string" instead.
6) Other
For Windows 7, only a (signed) 64-bit printer driver can be installed. I have no option of sticking with a 32-bit printer driver so that everything is 32-bit throughout. But VFP is 32-bit and so can only load 32-bit apps into its process space.
Are printer drivers loaded in process? I don't think so: I believe a 32-bit printer call from a 32-bit object in the process is emitted towared the kernel, and in a 64-bit environment is intercepted and redirected/changed to a 64-bit call to the 64-bit printer driver inside the kernel.
"OLE error code 0x800040154: Class not registered".
2) The setup
My work computer is a single physical machine running 64-bit Windows 7: however, it has a virtual PC running 32-bit Windows XP too. The VFP code works on the WinXP virtual machine but not on the Win7 machine itself.
Also, although it probably doesn't matter at all, I use Remote Desktop to connect to my work computer.
3) The VFP code is as follows:
Code:
LOCAL pBIDM AS LONG
LOCAL strPrinterName AS STRING
LOCAL frmBlackIceDevMode AS FORM
frmBlackIceDevMode = CREATEOBJECT("FORM")
frmBlackIceDevMode.ADDOBJECT("oBlackIceDevMode", "OleControl", "BLACKICEDEVMODE.BlackIceDEVMODECtrl.1")
strPrinterName = "JusticeTrax Imaging"
pBIDM = frmBlackIceDevMode.oBlackIceDevMode.LoadBlackIceDEVMODE(strPrinterName)
The line that throws the error - when run on the Win7 machine itself, but not when run on the virtual WinXP machine - is the ADDOBJECT() call.
4) Solution is simple, right?
The straightforward solution to a "Class Not Registered" error is to register the class. I have done so:
C:\Windows\System32>regsvr32.exe "<path and .ocx file name>"
and I receive a success message when I do. But the problem remains.
5) Class is registered
The class is registered: that is, I can find it in the Registry. Also, I may be wronb but I believe that if a truly unregistered class were referenced that the error would be "Invalid class string" instead.
6) Other
For Windows 7, only a (signed) 64-bit printer driver can be installed. I have no option of sticking with a 32-bit printer driver so that everything is 32-bit throughout. But VFP is 32-bit and so can only load 32-bit apps into its process space.
Are printer drivers loaded in process? I don't think so: I believe a 32-bit printer call from a 32-bit object in the process is emitted towared the kernel, and in a 64-bit environment is intercepted and redirected/changed to a 64-bit call to the 64-bit printer driver inside the kernel.