FBWOLF 发表于 2009-5-20 12:37:04

这段调用C的数据类型哪里是错误的?

$a = DllStructCreate("char vdrive")
DllCall("VDRIVESDK.dll", "int", "VdriveMount", $a, "vdrive" , "int" , 0)

以下是C的代码
#ifndef Unit1H #define Unit1H //--------------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> //--------------------------------------------------------------------------- class TForm1 : public TForm { __published: // IDE-managed Components TButton *Button1; TButton *Button2; TButton *Button3; TButton *Button4; TButton *Button5; TButton *Button6; TButton *Button7; void __fastcall Button1Click(TObject *Sender); void __fastcall Button2Click(TObject *Sender); void __fastcall Button3Click(TObject *Sender); void __fastcall Button4Click(TObject *Sender); void __fastcall Button5Click(TObject *Sender); void __fastcall Button6Click(TObject *Sender); void __fastcall Button7Click(TObject *Sender); private: // User declarations public: // User declarations __fastcall TForm1(TComponent* Owner); char vdrive; }; //--------------------------------------------------------------------------- extern PACKAGE TForm1 *Form1; //--------------------------------------------------------------------------- #endif


LPVOID lpMsgBuf;
      char strPath;
      int t = 0;
      t = VdriveMount(vdrive,0);
      FormatMessage(
                FORMAT_MESSAGE_ALLOCATE_BUFFER |
                FORMAT_MESSAGE_FROM_SYSTEM |
                FORMAT_MESSAGE_IGNORE_INSERTS,
                NULL,
                t,
                0, // Default language
                (LPTSTR) &lpMsgBuf,
                0,
                NULL
      );
      Application->MessageBoxA((const char *)lpMsgBuf,"提示",MB_OK);
      LocalFree(lpMsgBuf);
      t = 0;
      strPath = vdrive;
      strPath = ':';
      strPath = 0;
      t = DefineDosDevice(DDD_REMOVE_DEFINITION, strPath, NULL);
      if(t != 0) Application->MessageBoxA("DefineDosDevice成功", "提示", MB_OK);
页: [1]
查看完整版本: 这段调用C的数据类型哪里是错误的?