Zdravím, potřeboval bych pomoci s deklarací dll knihovny ve VB2010Ex. Jde o Ixchariot (program na měření propustnosti sítě) který má dll knihovnu, popsané API rozhraní (+.h file), ale stále se mi nedaří správná deklarace ve VB (z důvodů neznalosti C++). Z API nápovědy-CHR_api_initialize -------------------------------------------------------------------------------- DESCRIPTION The CHR_api_initialize function initializes the IxChariot API. This function must be called before any other IxChariot API function. CHR_API_RC CHR_api_initialize( CHR_DETAIL_LEVEL detail, CHR_STRING extended_info, CHR_LENGTH len, CHR_LENGTH* rtnlen ) PARAMETERS detail [in] The detail level for extended error information, if requested. Refer to Error Detail Levels on page 3-3 for available levels. If detail is set to CHR_DETAIL_NONE, the extended_info buffer pointer is null, or the buffer length is given as zero, no extended error information is returned if the API could not be initialized. If the buffer is valid but not big enough, truncated extended error information will be returned. extended_info [out] A pointer to the buffer where the extended error information should be returned. len [in] The length of the given buffer. rtnlen [out] A pointer to the variable where the number of bytes in the buffer is returned, excluding the null terminator--like strlen(). RETURN CODES The following return code indicates that the function call was successful: CHR_OK The following return codes indicate that an error occurred and any returned values should be ignored: CHR_OPERATION_FAILED CHR_POINTER_INVALID CHR_NO_MEMORY CHR_PGM_INTERNAL_ERROR CHR_VALUE_INVALID část header file typedef unsigned long CHR_DETAIL_LEVEL; #define CHR_DETAIL_LEVEL_NONE 0x0000 #define CHR_DETAIL_LEVEL_PRIMARY 0x00a3 #define CHR_DETAIL_LEVEL_ADVANCED (0x0014 | CHR_DETAIL_LEVEL_PRIMARY) #define CHR_DETAIL_LEVEL_ALL (0x0148 | CHR_DETAIL_LEVEL_ADVANCED) typedef char CHR_CHAR; typedef CHR_CHAR* CHR_STRING; typedef unsigned long CHR_LENGTH; typedef int CHR_API_RC; *-------------------------- Imports System.Runtime.InteropServices Imports System.Text Module Module1 Public Const CHR_RC_BASE = 100 Public Const CHR_OK = 0 Public Const CHR_POINTER_INVALID = (CHR_RC_BASE + 3) Public Const CHR_OPERATION_FAILED = (CHR_RC_BASE + 8) Public Const CHR_NO_MEMORY = (CHR_RC_BASE + 20) Public Const CHR_PGM_INTERNAL_ERROR = (CHR_RC_BASE + 21) Public Const CHR_VALUE_INVALID = (CHR_RC_BASE + 15) Public Const CHR_DETAIL_LEVEL_NONE As UInt32 = 0 Public Const CHR_DETAIL_LEVEL_PRIMARY As UInt32 = 163 Public Const CHR_DETAIL_LEVEL_ADVANCED As UInt32 = 20 Public Const CHR_DETAIL_LEVEL_ALL As UInt32 = 328 <DllImport("C:\Program Files\Ixia\Ixchariot\Chrapi.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _ Public Function CHR_api_initialize(<[In]()> ByVal detail As UInt32, <Out()> _ ByRef extended_info As StringBuilder, _ <[In]()> ByVal len As UInt32, <Out()> ByRef rtnlen As UInteger) As Int32 End Function End Module ---- volani Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim p As Int32 Dim K As StringBuilder = New StringBuilder(4096) K.Capacity = 4 Dim L As UInt32 p = CHR_api_initialize(CHR_DETAIL_LEVEL_ALL, K, CHR_MAX_ERROR_INFO, L) End Sub byl bych moc moc šťasný kdyby mi někdo pomohl. pořád to padá na unbalanced stack. Díky Tomáš
|