| Author |
Message |
jjones7947
Joined: 17 Mar 2010 Posts: 2
|
Posted: Wed Mar 17, 2010 2:14 pm Post subject: Problem getting correct parameter types for P/Invoke call |
|
|
Trying to Interop a functionality from the Outside In API from Oracle.
Have the following function:
| Code: |
SCCERR EXOpenExport { VTHDOC hDoc, VTDWORD dwOutputId, VTDWORD dwSpecType, VTLPVOID pSpec, VTDWORD dwFlags, VTSYSPARAM dwReserved, VTLPVOID pCallbackFunc, VTSYSPARAM dwCallbackData, VTLPHEXPORT phExport);
|
From the header files I reduced the parameters to:
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
Documentation says that this type is a non-filesystem handle
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 instantiated 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:
| Code: |
phDoc as a IntPtr which was loaded with an address by the DAOpenDocument function called before
dwOutputId as uint set to 1535 which represents FI_JPEGFIF
dwSpecType as int set to 2 which represents IOTYPE_ANSIPATH
pSpec as an IntPtr.Zero where the output will be written
dwFlags as uint set to 0 as directed
dwReserved as uint set to 0 as directed
pCallbackFunc as IntPtr set to NULL as I will handle results
dwCallBackDate as uint the address of a buffer for a struct
phExport as IntPtr to another struct buffer
|
still get an undefined error from the API. By that I mean that when I call the function through P/Invoke it returns 961 which does not correlate to any of the errors defined in the header files. Past experience says that I get this result when my choice of parameter types is incorrect.
Jim |
|
| Back to top |
|
 |
Paul.Martin
Joined: 03 Feb 2010 Posts: 83 Location: Cambridgeshire
|
Posted: Thu Mar 18, 2010 4:10 pm Post subject: |
|
|
| I've not used the Oracle Outside In API so I can't say with any confidence, but looking at the specification - if you set pSpec to NULL (IntPtr.Zero) you need to pass a callback function in pCallbackFunc that will handle a dwCommandID of EX_CALLBACK_ID_CREATENEWFILE. |
|
| Back to top |
|
 |
jjones7947
Joined: 17 Mar 2010 Posts: 2
|
Posted: Thu Mar 18, 2010 7:11 pm Post subject: |
|
|
| Ok will give that a try |
|
| Back to top |
|
 |
Paul.Martin
Joined: 03 Feb 2010 Posts: 83 Location: Cambridgeshire
|
Posted: Mon Mar 29, 2010 5:24 pm Post subject: |
|
|
| Did you get any success with this? |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group