天啊~~~Delphi的高手呢?~~~~~

解决方案 »

  1.   

    建议将 string 改成 pchar,试试看。
      

  2.   

    //delphi
    function GetCharInd(zzchar: PChar):char; stdcall;//BCB
    typedef char (__stdcall *TGetCharInd)(PChar);TGetCharInd GetCharInd = NULL;void __fastcall TForm1::Button1Click(TObject *Sender)
    {
       AnsiString DLLFile = "C:\\project2.dll";
       HINSTANCE hHandle = LoadLibrary(DLLFile.c_str());
       try
       {
         AnsiString ProcName = "GetCharInd";
         GetCharInd = (TGetCharInd)GetProcAddress(hHandle, ProcName.c_str());
         if (GetCharInd == NULL)
           ShowMessage("GetProcAddress Error");
         else
         {
           char C = GetCharInd(Edit1->Text.c_str());
           if (C == '\0')
             ShowMessage("#0");
           else
             ShowMessage(C);
         }
       }
       __finally
       {
         FreeLibrary(hHandle);
         GetCharInd = NULL;
       }
    }