I am not very experienced in OCX stuff but I am trying now to incorporate one in a project…
I want to incorporate receipt printers in my app, for that I thought I’d use the OCX they distribute…
The component is loaded in the project without errors (after changing the date values to doubles and removing the ‘end of procedure’ lines)… but so far the only way to connect to it was by creating an instance of an OLEobject.
The problem with this approach is I cannot get the data reply that the component returns back to Xojo. The OCX provides structures for the return data, but even though the structures seem show up fine in the debugger at runtime, I always get a nilObject Exception when trying to use them…
As an alternative option I tried creating an instance and using the OCX without creating the OLEObject, and it still doesn’t work…
If the OCX file does not appear in Xojo, then the OCX file will need to be registered.
Open a command prompt, and go to the folder where the OCX is located. Type the following command to register the OCX file (example filename: Printer.OCX)
Regsvr32 Printer.OCX
The OCX file should now appear in Xojo to insert an ActiveX component.
Hey Eugene… thanks for your reply… The OCX DOES show up and I managed to insert it (after changing the date values to doubles and removing the ‘end of procedure’ lines)… the problem is, somehow, it does not connect…
Depending on the version of the OCX I either get a NilObject Exception in the line
if mThis = Nil Then Raise New NilObjectException
of the first method I onvoke…
OR a ComObjectException in the same firstmethod I invoke…
[quote=345248:@Roman Varas]Hey Eugene… thanks for your reply… The OCX DOES show up and I managed to insert it (after changing the date values to doubles and removing the ‘end of procedure’ lines)… the problem is, somehow, it does not connect…
Depending on the version of the OCX I either get a NilObject Exception in the line
if mThis = Nil Then Raise New NilObjectException
of the first method I invoke…
OR a ComObjectException in the same first method I invoke…[/quote]
Sorry, I don’t see any code to understand the purpose of the OCX and the reason behind the resulting mThis call. There are quite a few possibilities that it could be:
Possibly changing the date values to doubles?
Depends on how the object instance was created?
Does the instance need to be connected to a printer?
The list goes on.
Without code, that’s about as far as I can help. I wish you the best.