473,672 Members | 2,597 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 1317

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

Similar topics

5
3534
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
2127
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
1968
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
8506
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8852
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...
1
8649
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5725
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
4251
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
4447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2847
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
2098
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1843
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.