.NET DLL for use with older Windows Application

Oct 8 2008 9:52 AM

Hello,  I am trying to create a DLL which can be called by 3rd party application that I use.  I have received the specification for the DLL from the vendor but I cannot get it to call - it is currently crashing.  At first I could not get the application to see the function in the DLL but after some advise I have used the ILDASM and ILASM programs to decompile the created DLL to IL, edit the IL file and the recompile the DLL.  This has resolved the problem of the program not being able to see the function but it crashes the program.  Below is the specification sent by the vendor - can somebody help me with this?

Specification

Function Prototype

int__far__pascal__export UserInstruction (HWIND hWind, HINSTANCE hinst, double __far*lpNumeric, char __far*lpAlpha1, char __far*lpAlpha2)

int - means the function returns an integer

far - means it is compiuled using a 16bit address

pascal - means the parameters are passed using the pascal calling convention (required for all Windows DLL)

export - means that the function can be accessed outside of the DLL it is compiled in.

UserInstruction - is the name of the function called.

HWIND hWind - 16bit calling handle to the window

HINSTNACE hInst - 16bit calling handle to the instance of the application.

double __far *lpNumeric - 16bit pointer to a double precision number

char __far*lpAlpha1 - 16bit pointer to an array of characters (a string)

char __far*lpAlpha2 - 16bit pointer to an array of characters (a string)

 

VB Call

Public function UserInstruction (ByRef hWind as Long, ByRef hInstance as Long, ByVal nArray as Double, ByVal Param1 as String, ByVal Param2 as String) as Integer


Answers (1)