|
-
Typedef Declaration in VB
Hi all !
I'm just about to use a DLL made in C++, I'll need some help to declare all "TypeDef" and functions in a vb fashion way.
PLEASE GIVE EXPLANATIONS thankls
The most important for now are the CONNECTION_ADDR type and the NetApiConnect method....
Can you help me to understand how the sruct should be declared in VB, and also the method ?
Here's how I declared the "API function in vb so far...
Private Declare Function NetApiConnect Lib "NetApi" (IN CONNECTION_ADDR * prConnAddr,
IN int nNumConnections) As Long
I'm now posting part of the .h file.
typedef struct {
CONNECTION_TYPE eType;
union {
SOCKET_ADDR rSocket;
MODEM_ADDR rModem;
COMM_PORT_ADDR rCommPort;
GENERIC_ADDR rGeneric;
};
} CONNECTION_ADDR;
typedef int (* LOG_CALLBACK)(
IN int nRid,
IN OB_LOG_ENTRY * prObLogEntry,
IN unsigned long nCallbackParameter
);
typedef enum {
SOCKET_TYPE,
MODEM_TYPE,
COMM_PORT_TYPE,
UNKNOWN_CONN_TYPE,
_LAST_CONN_TYPE
} CONNECTION_TYPE;
typedef struct {
unsigned long ulIpAddress;
char acHost[ MAX_HOST_NAME_LEN ];
unsigned short nPort;
} SOCKET_ADDR;
typedef struct {
char acCallString[64];
} MODEM_ADDR;
typedef struct {
int nPort;
} COMM_PORT_ADDR;
typedef struct {
char acData[ CONNECTION_ADDR_MIN_SIZE ];
} GENERIC_ADDR;
typedef struct _SESSION * SESSION_ID;
typedef struct _REQUEST * REQUEST_ID;
typedef int (* VIDEO_CALLBACK)(
IN int nRid,
IN OB_VIDEO * prObVideo,
IN int nError,
IN SESSION_ID hSessionId,
IN REQUEST_ID hRequestId,
IN unsigned long nCallbackParameter
);
typedef enum {
SEEK_TIME_ABSOLUTE,
SEEK_TIME_LIVE,
SEEK_TIME_BEFORE,
SEEK_TIME_AFTER,
SEEK_NEXT,
SEEK_PREV,
SEEK_GET_TIME,
SEEK_GET_TIME_AND_RID
} SEEK_TYPE;
#define PLAYBACK_REVERSE 0x01
#define PLAYBACK_FRAME_CURRENT 0x02
#define PLAYBACK_FRAME_ALL 0x04
#define PLAYBACK_REAL_TIME 0x08
#define PLAYBACK_NO_DROPS 0x10
#define PLAYBACK_LIVE_MODE 0x20
typedef enum {
CFG_LIVE_MODE_QUALITY,
CFG_VERSION,
CFG_NO_SEEK_ON_CONNECT,
} CONFIG_TYPE;
typedef struct {
char acVersion[64]; // Version label. May or may not be specified.
// Empty string if unspecified.
unsigned long nMajor;
unsigned long nMinor;
unsigned long nPatch;
unsigned long nBuildNo;
} VERSION_INFO;
#undef DLL_DECLSPEC
#ifdef NETAPI_EXPORTS
#define DLL_DECLSPEC __declspec(dllexport)
#else
#define DLL_DECLSPEC __declspec(dllimport)
#endif
DLL_DECLSPEC int
NetApiConnect(
IN CONNECTION_ADDR * prConnAddr,
IN int nNumConnections
);
DLL_DECLSPEC int
NetApiDisconnect(
);
DLL_DECLSPEC int
NetApiGetResources(
OUT OB_RESOURCE ** pprResources,
OUT int * pnNumResources
);
DLL_DECLSPEC int
NetApiGetRid(
IN int nUniqueId,
IN RESOURCE_TYPE eType,
IN int nParameter
);
DLL_DECLSPEC int
NetApiGetObject(
IN int nRid,
IN RVCOBTYPE eObject,
OUT void * pvObject,
IN int nSize,
OUT int * pnPercentRemaining
);
DLL_DECLSPEC int
NetApiSetObject(
IN int nRid,
IN RVCOBTYPE eObject,
IN void * pvObject,
IN int nSize,
OUT int * pnPercentRemaining
);
DLL_DECLSPEC int
NetApiVideoPlay(
IN int * pnRids,
IN int nNumRids,
IN int nMainVideoIndex,
IN VIDEO_CALLBACK pCallback,
IN unsigned long nCallbackParameter,
IN int nFlags
);
DLL_DECLSPEC int
NetApiVideoStop(
);
DLL_DECLSPEC int
NetApiVideoSeek(
IN OUT FILETIME * pnTime,
IN SEEK_TYPE eSeekType,
OUT BOOL * pbSeekHit
);
DLL_DECLSPEC int
NetApiLogUpdateSection(
IN LOG_TYPE eLog,
IN int nFirstEntry,
IN int nNumEntries,
IN LOG_CALLBACK pCallback,
IN unsigned long nCallbackParameter,
IN int nFlags
);
DLL_DECLSPEC int
NetApiLogGetSize(
IN LOG_TYPE eLog
);
DLL_DECLSPEC void
NetApiGetCfg(
IN CONFIG_TYPE eConfigType,
OUT void * pvConfigData,
IN int nConfigSize
);
DLL_DECLSPEC void
NetApiSetCfg(
IN CONFIG_TYPE eConfigType,
OUT void * pvConfigData,
IN int nConfigSize
);
DLL_DECLSPEC int
NetApiGetConnectionStatus(
IN int nConnection,
OUT int * pnLine,
OUT char ** ppcFile,
OUT int * pnExtendedError
);
DLL_DECLSPEC char *
NetApiGetLastErrors(
);
/*
* Undocumented function
*/
DLL_DECLSPEC char *
ErrString(
IN int nErr
);
#ifdef __cplusplus
}
#endif
#endif
Similar Threads
-
Replies: 20
Last Post: 09-22-2002, 11:54 PM
-
By Glen Kunene in forum Talk to the Editors
Replies: 17
Last Post: 03-23-2002, 12:43 AM
-
By MaRiŲ in forum VB Classic
Replies: 0
Last Post: 10-01-2001, 10:46 AM
-
Replies: 90
Last Post: 04-17-2001, 12:45 AM
-
By peter higgins in forum VB Classic
Replies: 0
Last Post: 03-21-2001, 12:58 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks