DLL import in C#: function parameters conversion problem

  • Thread starter Thread starter Martin Daøílek
  • Start date Start date
M

Martin Daøílek

Hi all,

please can You help me with translation of function parameters provided by
p2smon.dll library (Crystal Reports)? Any example, which I found, is only in
VB (I don't like it :-)

I would like use this function for runtime creating of reports ...

function name:
-------------------
CreateReportOnRuntimeDS()

Parameters:
--------------

Declare Function CreateReportOnRuntimeDS Lib "p2smon.dll" (
lpUnk As Object,
ByVal reportFile As String,
ByVal fieldDefFile As String,
ByVal bOverWriteFile As Long,
ByVal bLaunchDesigner As Long
) As Long

Parameter Description
------------------------

LpUnk - The active data source used to create the field definition file. In
C or C++, this is a pointer to an IUnknown derived COM interface relating to
a DAO or ADO Recordset. In Visual Basic, this is a Recordset or Rowset
object.

ReportFile - The path and file name of the report file to be created.

FieldDefFile - The path and file name of the field definition file to be
created.

BoverWriteFile - If a field definition file already exists with the
specified path and file name, this flag indicates whether or not to
overwrite that file.

BlaunchDesigner - If True (1), Crystal Reports is launched with the newly
created report file opened. Crystal Reports must be installed on the system.
 
Martin,
Declare Function CreateReportOnRuntimeDS Lib "p2smon.dll" (
lpUnk As Object,
ByVal reportFile As String,
ByVal fieldDefFile As String,
ByVal bOverWriteFile As Long,
ByVal bLaunchDesigner As Long
) As Long

If that works in VB6, I'd try this in C#

[DllImport("p2smon.dll")]
static extern int CreateReportOnRuntimeDS(
[MarshalAs(UnmanagedType.Interface)] ref object lpUnk,
string reportFile,
string fieldDefFile,
int bOverWriteFile,
int bLaunchDesigner);



Mattias
 
Back
Top