Converting OCX, ActiveX and DLL calls to X#
Posted: Tue Nov 28, 2023 9:48 am
The project I am working on (a conversion from VO to X#) uses a lot of OLE stuff which I am trying to get working in X#. Specifically, there is a report generator called R&R ReportWorks that has an OCX and also a DLL. The OCX is of course used with OleControl, CreateEmbedding, InitAutoObject etc. Besides that it uses cOleMethod{} a lot, of which the VO Help says "This class is used for internal implementation only and is not intended to be used directly." An example of this is:
(Note: RRSQLReport inherits from OleControl, oAuto is an OleAutoObject)
The DLL is used with _DLL calls like this:
_DLL FUNCTION RRexecRuntime(HReport AS INT, bWait AS INT, FsCmdShow AS INT, eCode AS PTR, pPageCount AS PTR, EMsg AS PSZ, Emsgsize AS INT) AS BYTE PASCAL:RSRPT32.execRuntime
Not surprisingly, adding the OCX (rsw32.ocx) or the DLL (rsrpt32.dll) as a reference in X# results in an error (“Could not load file or assembly ‘rsrpt32.ddl’ or one of its dependencies. The module was expected to contain an assembly manifest.”)
I have several questions about this.
- I have seen "Example 5" in the X# documentation, but this is an entirely different OCX. Will the tricks used here work for any OCX or just for the one in the e-mail sample?
- What is the reason that these components are not supported in X#, is it the fact that they are 32-bit, or is the code unsafe, is it the missing assembly manifest? What would the requirements be for X# support? Would 64-bit ActiveX controls work?
- How can I get the cOleMethod{} code to work in X#, port the source code for this or is there a better way?
- I can't find anywhere what _BP exactly is. In VO it has the colour of "operators". It does not seem to exist in X#.
Many thanks to anyone who can shed some light on it!
Kees.
Code: Select all
METHOD AboutBox( ) CLASS RRSQLReport
LOCAL oMethod AS cOleMethod
LOCAL uRetValue AS USUAL
oMethod := cOleMethod{}
oMethod:symName := String2Symbol("AboutBox")
oMethod:iMemberid := -552
oMethod:wInvokeKind := INVOKE_METHOD
uRetValue := SELF:oAuto:__Invoke(oMethod, DWORD(_BP+16),PCount())
RETURN (uRetValue)
The DLL is used with _DLL calls like this:
_DLL FUNCTION RRexecRuntime(HReport AS INT, bWait AS INT, FsCmdShow AS INT, eCode AS PTR, pPageCount AS PTR, EMsg AS PSZ, Emsgsize AS INT) AS BYTE PASCAL:RSRPT32.execRuntime
Not surprisingly, adding the OCX (rsw32.ocx) or the DLL (rsrpt32.dll) as a reference in X# results in an error (“Could not load file or assembly ‘rsrpt32.ddl’ or one of its dependencies. The module was expected to contain an assembly manifest.”)
I have several questions about this.
- I have seen "Example 5" in the X# documentation, but this is an entirely different OCX. Will the tricks used here work for any OCX or just for the one in the e-mail sample?
- What is the reason that these components are not supported in X#, is it the fact that they are 32-bit, or is the code unsafe, is it the missing assembly manifest? What would the requirements be for X# support? Would 64-bit ActiveX controls work?
- How can I get the cOleMethod{} code to work in X#, port the source code for this or is there a better way?
- I can't find anywhere what _BP exactly is. In VO it has the colour of "operators". It does not seem to exist in X#.
Many thanks to anyone who can shed some light on it!
Kees.