找回密码
 加入
搜索
查看: 1247|回复: 0

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

[复制链接]
发表于 2009-5-20 12:37:04 | 显示全部楼层 |阅读模式
$a = DllStructCreate("char vdrive[424]")
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[424]; }; //--------------------------------------------------------------------------- extern PACKAGE TForm1 *Form1; //--------------------------------------------------------------------------- #endif


LPVOID lpMsgBuf;
        char strPath[MAX_PATH];
        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[0] = vdrive[0];
        strPath[1] = ':';
        strPath[2] = 0;
        t = DefineDosDevice(DDD_REMOVE_DEFINITION, strPath, NULL);
        if(t != 0) Application->MessageBoxA("DefineDosDevice成功", "提示", MB_OK);
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-15 08:34 , Processed in 0.079445 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表