Call VB ActiveX dll from C language
Posted on 2004-04-06
The scenario is simple - a screen displays a list of data. Click an item on the list to display an scanned image. A document id is passed to determine which image to display. IBM imaging software displays the image.
Problem is: IBM imaging software uses ActiveX VB dll to display image and screen is written in J. D. Edwards which is a low level C language, so I must call the VB dll from C language. I'm using MS Studio 6. I wonder if this is possible?????
I have the following so far. When I click the screen, it goes through the program and does nothing. I have tried to debug this by adding some dll's into the Program Settings with no success. A window pops up showing the Disassembly, breakpoints are not recognized and I can't display any field values.
Any help is very much appreciated ... Jim
// code from header
typedef (*PFNJDE2CM)( LPCSTR ); // VB dll to call receives one string parm
typedef struct tagDSD550413M
char szDOCNAME; // string parm is passed into this header
} DSD550413M, *LPDSD550413M; // and stored in this struct
#define IDERRszDOCNAME_2 1L
// code from .c
#include <B550413M.h> // this is header above
int nResult = 0;
hLibrary = LoadLibrary("c:\\JDE2CM.dll.dll"); // this is VB dll
if(hLibrary != NULL)
// gets the address of the function inside the VB dll
lpJDE2CM = (PFNJDE2CM) GetProcAddress (hLibrary, "DllGetClassObject");
// call the VB dll function
const char *docid = 0;
docid = lpDS->szDOCNAME;
nResult = lpJDE2CM(docid);