473,657 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ODM API calls from C# .NET

Really need some help with a problem that is bugging me.

I am trying to wrtie a C#.NET wrapper for the ODM (Open Document
Management)
API. I have written wrapping classes for other Windows API's in the
past in
VB6 and have not had a problem. However, VB6 is not a 'strictly typed'
language, and I think it is the type conversions from C# to the ODM
API that
is cauing my problem.

The following is an extract from the "ODMA.h" file that contains the
definitions of the ODM API

//----------------------------------------------------
ODMSTATUS WINAPI ODMSaveAsEx(ODM HANDLE odmHandle, LPSTR lpszDocId,
LPSTR lpszNewDocId, LPSTR lpszFormat, ODMSAVEASCALLBA CK pcbCallBack,
LPVOID pInstanceData, LPDWORD pdwFlags);
//----------------------------------------------------

The following is my declaration in C# of this API function

//----------------------------------------------------
[DllImport("ODMA 32.DLL", EntryPoint="ODM SaveAsEx")]
internal static extern Int16 ODMSaveAsEx
(
Int32 odmHandle,
string lpszDocId,
StringBuilder lpszNewDocId,
string lpszFormat,
Int32 pcbCallBack,
Int32 pInstanceData,
ref Int32 pdwFlags
);
//----------------------------------------------------

I am calling the API function via my declaration using the following
code

//----------------------------------------------------
/*
THESE 3 VARIABLES ARE ALREADY SET FROM PREVIOUS
CALLS TO OTHER ODM API METHODS
Int32 lngSessionID = //<The current session ID>//
string strDocID = //<The current document ID>//
string strDocumentForm at = //<The current docuemtn format>//
*/
Int16 intSuccess;
Int32 intCallBack = 0;
Int32 intInstanceData = 0;
Int32 intFlags = 0;
StringBuilder strBuffer = new StringBuilder(2 55);

intSuccess = ODMSaveAsEx (lngSessionID, strDocID,
strBuffer, strDocumentForm at, intCallBack,
intInstanceData , ref intFlags);
//----------------------------------------------------

When I run this call to "ODMSaveAsE x" I get the following error.

//----------------------------------------------------
An unhandled exception of type
'System.NullRef erenceException ' occurred in odmadocmanager. dll

Additional information:
Object reference not set to an instance of an object.
//----------------------------------------------------

Now I know what it looks like. I looks like I am passing a NULL
refernece to
this API call. This is not the case. I am absolutely sure that this
problem is
related to type compatability.

* Does anyone know of any specific Type conversion problems when
calling API's from C#?
* Has anyone ever done any development on the ODM API with .NET?

I know that you have to watch out for the following...

LONG (API world) = Int32 (.NET world)
INT (API world) = Int16 (.NET world)

....and I have tried to ensure that the correct type is used in my C#
code.
However, I am still stuck on this.
Can anyone help?

Much appreciated!!!
Cluggas
Nov 16 '05 #1
0 1316

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3532
by: markus | last post by:
Hi, I have a question that deals with the standard c library VS (Unix) system calls. The question is: which header files (and functions) are part of the C library and which header files (and function calls) are part of the (Unix) system calls. The cause of my confusion is that for example stdio.h is considered
6
2126
by: A.M-SG | last post by:
Hi, We are developing a SmartClient application and we are planning to expose business objects layer to SmartClient application by using ASP.NET SOAP web services.
10
2629
by: Brian Parker | last post by:
I inherited a C++ DLL that I need to remotely call multiple times asynchronously. What I have developed is: CSharp web application that makes asynchronous calls to a CSharp Web Service. The Web Service calls the DLL, which does some heavy processing, then sends the results back to the CSharp web application. The problem is that the calls to the DLL in the Web Service are blocking each other. If I send 10 async requests to the Web...
21
2440
by: omkar pangarkar | last post by:
Hi all, I have two simple hello world programs one using printf() and other using write() --prog 1-- #include<stdio.h> #include<stdlib.h> int main() { printf("Hello"); /* up to here write() isn't called, if u * give \n here then two write()s will
1
1966
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... There are a few questions wrapped up in this, but the main one is that the WebService.MyMethodAsync() methods that are automatically generated in the client code by VS 2005 don't seem to be finishing for me. We have a VS add-in written in .net that used to make a number of database calls to fill forms. To improve security, we moved the db calls to a web service and return DataSets for the calls (the result sets are always...
0
8826
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7330
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6166
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4306
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.