문제

다음 Delphil DLL 선언이 주어졌습니다

function csd_HandleData(aBuf: PChar; aLen: integer): integer; stdcall;

VB6 선언은 무엇입니까?

나는 다양한 선언을 시도했다

Declare Function csd_HandleData Lib "chsdet.dll" (ByVal aBuf As String, ByVal aLen As Integer)
Declare Function csd_HandleData Lib "chsdet.dll" (aBuf As Long, ByVal aLen As Integer)
Declare Function csd_HandleData Lib "chsdet.dll" (aBuf As Byte, ByVal aLen As Integer)

매개 변수에 맞는 관련 코드가 있지만 아무것도 작동하지 않는 것 같습니다. 즉, 델파이 디버거는 알렌에 너무 끔찍한 값과 abuf의 널 스트링이 있다고 말합니다.

나는 Typelib를 사용하여 연결을 주도하기 위해 노력하고 있지만 선언과 함께 프로토 타이핑을하고있었습니다.

도움이 되었습니까?

해결책

노력하다

Declare Function csd_HandleData Lib "chsdet.dll" (ByVal aBuf As String, 
ByVal aLen As Integer) As Integer

반환 값을 잊어 버린 것 같습니다.

다른 팁

VB 정수 데이터 유형은 16 비트이므로 델파이 및 기타 언어의 정수와 동등한 오랫동안 선언해야합니다.

Declare Function csd_HandleData Lib "chsdet.dll" (ByVal aBuf As String, ByVal aLen As long) as long

나는 델파이에서 PCHA가 무엇인지 모르겠다. 단지 하나의 캐릭터입니까? ASCII ?? 유니 코드?

정수는 VB6에서 16 비트이며 Alen을 32 비트를 유지할 수있는 Alen을 길게 선언해야합니다.

또한 함수의 반환 유형을 선언해야합니다.이 경우 긴 값도 반환하려고합니다.

이것은 아마도 작동 할 것입니다 : 함수 csd_handledata lib "chsdet.dll"(바이트로서의 abuf, byval alen rong)

관심있는 사람들을 위해 다음은 Typelib의 최종 IDL입니다. Chsdet. (Matt Curland의 edittlb 도구를 다시 발견 한 후) 감동 한 것은 구조를 타입 립에 넣을 수 있다는 것이었고 VB는 소스 코드에서 선언 한 것처럼 처리합니다.

나는 Chsdet의 저자에게 편지를 썼는데 아마도 이것은 표준 배포판의 일부로 끝날 것입니다.

// Generated .IDL file (by the OLE/COM Object Viewer)
// 
// typelib filename: chsdet.tlb

[
  uuid(316A83D7-8BF4-490E-BDDE-75EBC332C355),
  version(1.0),
  helpstring("Charset Detector - as the name says - is a stand alone executable module for automatic charset detection of a given text.\r\n\t\r\nIt can be useful for internationalisation support in multilingual applications such as web-script editors or Unicode editors.\r\n\t\r\nGiven input buffer will be analysed to guess used encoding. The result can be used as control parameter for charset conversation procedure.\r\n\t\r\nCharset Detector can be compiled (and hopefully used) for MS Windows (as dll - dynamic link library) or Linux.\r\n\t\r\nBased on Mozilla's i18n component - http://www.mozilla.org/projects/intl/. \r\n\r\nCharset Detector is open source project and distributed under Lesser GPL.\r\nSee the GNU Lesser General Public License for more details - http://www.opensource.org/licenses/lgpl-license.php\r\n\r\nNikolaj Yakowlew \xFFFFFFA9 2006-2008 \r\nTypeLib by Bruce M. Axtens, 2008.")
]
library CHSDET
{
    // TLib :     // Forward declare all types defined in this typelib

    [
      dllname("CHSDET.dll"),
      version(1.0),
      helpstring("Functions in CHSDET.DLL")
    ]
    module CHSDETFunctions {
    [entry(0x60000000), helpstring("Returns rAbout record (qv)")]
    void _stdcall GetAbout([in, out] rAbout* AboutRec);
    [entry(0x60000001), helpstring("Reset detector. Prepares for new analysis.")]
    void _stdcall Reset();
    [entry(0x60000002), helpstring("Analyse given buffer of specified length.

Return value is of eHandleDataErrors, either 
NS_ERROR_OUT_OF_MEMORY (Unable to create internal objects) or NS_OK.

Function can be called more that one time to continue guessing. Charset Detector remembers last state until Reset called.")]
    void _stdcall HandleData(
            [in] BSTR aBuf, 
            [in] short aLen, 
            [out, retval] short* retVal);
    [entry(0x60000003), helpstring("Returns either TRUE (Charset Detector is sure about text encoding.) or FALSE.

NB: If input buffer is smaller then 1K, Charset Detector returns FALSE.")]
    void _stdcall IsDone([out, retval] short* retVal);
    [entry(0x60000004), helpstring("Signal data end. If Charset Detector hasn't sure result (IsDone = FALSE) the best guessed encoding will be set as result.")]
    void _stdcall DataEnd();
    [entry(0x60000005), helpstring("Returns guessed charset as rCharsetInfo record")]
    void _stdcall GetDetectedCharset([out, retval] rCharsetInfo* retVal);
    [entry(0x60000006), helpstring("Returns all supported charsets in form "0x0A Name - CodePage"")]
    void _stdcall GetKnownCharsets(
            [in, out] long* sList, 
            [out, retval] long* retVal);
    [entry(0x60000007), helpstring("Return eBOMKind value matching byte order mark (if any) of input data.")]
    void _stdcall GetDetectedBOM([out, retval] eBOMKind* retVal);
    [entry(0x60000008), helpstring("Remove CodePage from consideration as a possible match")]
    void _stdcall DisableCharsetCP([in] long CodePage);
    };

    typedef [uuid(91694067-30AB-44A9-A210-F5602935475F)]
    struct tagrAbout {

long lMajor;

long lMinor;

long lRelease;

long sAbout;
    } rAbout;

    typedef [uuid(3C8B7420-D40B-458B-8DE8-9B3D28607396)]
    enum {
    BOM_Not_Found = 0,
    BOM_UCS4_BE = 1,
    BOM_UCS4_LE = 2,
    BOM_UCS4_2143 = 3,
    BOM_UCS4_3412 = 4,
    BOM_UTF16_BE = 5,
    BOM_UTF16_LE = 6,
    BOM_UTF8 = 7
    } eBOMKind;

    typedef [uuid(9B231DEF-93FB-440D-B06B-D760AECE09D0)]
    struct tagrCharsetInfo {

long Name;

short CodePage;

long Language;
    } rCharsetInfo;

    typedef enum {
    NS_OK = 0,
    NS_ERROR_OUT_OF_MEMORY = -2147024882
    } eHandleDataErrors;
};

VB가 어떻게 작동하는지 정확히 알지 못하지만 PCHA는 포인터이므로 값 대신 참조를 얻으십시오.

Declare Function csd_HandleData Lib "chsdet.dll" (**ByReference <--guessing here :D** aBuf As String, ByVal aLen As Integer)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top