From the header files I reduced the parameters to:
Code
typedef VTSYSPARAM VTHDOC, VTLPHDOC *
typedef DWORD_PTR VTSYSPARAM
typedef unsigned long DWORD_PTR
typedef unsigned long VTDWORD
typedef VTVOID* VTLPVOID
#define VTVOID void
typedef VTHDOC VTHEXPORT, *VTLPEXPORT
These are for 32 bit windows
Going through the header files, the example programs, and the documentation I found: 1. That pSpec could be a pointer to a buffer or NULL, so I set it to a IntPtr.Zero (documentation). 2. That dwFlags and dwReserved according to the documentation "Must be set by the developer to 0". 3. That pCallbackFunc can be set to NULL if I don't want to handle callbacks. 6. That the last two are based on structs that I wrote C# wrappers for using the [StructLayout(LayoutKind.Sequential)]. Then instatiated an instance and generated the parameters by first creating a IntPtr with Marshal.AllocHGlobal(Marshal.SizeOf(instance)), then getting the address value which is passed as a uint for dwCallbackData and a IntPtr for phExport.
The final parameter list is as follows:
VB.NET
phDoc as a IntPtr which was loaded with an address by the DAOpenDocument function called before
dwOutputId as uint setto1535 which represents FI_JPEGFIF
Code
dwSpecType as int set to 2 which represents IOTYPE_ANSIPATH
Code
pSpec as an IntPtr.Zero where the output will be written
Code
dwFlags as uint set to 0 as directed
Code
dwReserved as uint set to 0 as directed
Code
pCallbackFunc as IntPtr set to NULL as I will handle results
Code
dwCallBackDate as uint the address of a buffer for a struct
Code
phExport as IntPtr to another struct buffer
still get an undefined error from the API.
Jim
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Sam HobbsRank #107 · 20.5K reputationPosted Mar 16, 2010, 11:28 AM EDT
0
I think you need to compile the code; the API does not compile. Or maybe I just don't understand what you mean by "from the API". How are you getting an error from the API? I have not heard of that; I don't know how to compile using the API.
I think you must define the undefined error. I don't know what is not defined and I doubt that anyone else does.
Thank you for all the details, but I think some of the most important details are not provided.
Jim Jones10 reputationPosted Mar 19, 2010, 8:09 AM EDT
0
Sam,
The function shown is only one of many in the API. It does not compile. You surely must have seen errors from libraries/APIs/.libs/.dlls. Most of them have them and document them in a header file. This API has sccerr.h which is filled with several hundred. When I say the error is undefined, I mean that the function call from C# Interop returns 961, when I look for that number in the errors, I don't find it. Since it's being return from the dll, there isn't much I can do to figure out what it means.
In the past, working with this API I've gotten that code when my choice of parameters where incorrect. So looking for some insight into which parameters may be the problem.
Sam HobbsRank #107 · 20.5K reputationPosted Mar 16, 2010, 11:28 AM EDT
I think you must define the undefined error. I don't know what is not defined and I doubt that anyone else does.
Thank you for all the details, but I think some of the most important details are not provided.
Jim Jones10 reputationPosted Mar 19, 2010, 8:09 AM EDT
The function shown is only one of many in the API. It does not compile. You surely must have seen errors from libraries/APIs/.libs/.dlls. Most of them have them and document them in a header file. This API has sccerr.h which is filled with several hundred. When I say the error is undefined, I mean that the function call from C# Interop returns 961, when I look for that number in the errors, I don't find it. Since it's being return from the dll, there isn't much I can do to figure out what it means.
In the past, working with this API I've gotten that code when my choice of parameters where incorrect. So looking for some insight into which parameters may be the problem.