[問題] 請問有關DLL檔案的建立
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
VC++2008
問題(Question):
請問建立DLL檔案給VB使用,VC部分編譯有過,可是在VB的部分有出現錯誤,想請問是
哪個部分出錯
錯誤結果(Wrong Output):
無法載入DLL :找不到指定的模組 例外狀況HERSULT: 0x8007007E
字串至型別Interger的轉換是無效的System.FormatException: 輸入字串格式不正確。
程式碼(Code):(請善用置底文網頁, 記得排版)
int _stdcall TEST()
{
int i=0,t=0;
fstream fin("file.txt",ios::in);
string tmp="";
if(fin.fail()) cout<<"Error\n";
while(!fin.eof()){ //讀到檔尾則停止
for (i=0;i<25;i++){
while(fin>>tmp){ //將不想要的字串讀入
if(tmp == "Temp:"){ //如果是"temperature",則準備讀入數字
fin>>temper[i]; //因為還有一個":",將":"讀入tmp中在讀入數字
break;
} }
}
}
for(i=0;i<=20;i++)
{
if(temper[i]>t)
t= temper[i];}
cout<<t<<endl;
system("PAUSE");
return t;
}
VB部分
Declare Function TEST Lib "TESTDLL1" () As Integer
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim D As Integer
D = TEST()
TextBox4.Text = D
End Sub
End Class
補充說明(Supplement):
因為DLL部分是從文件檔讀資料不需要引數,所以直接刪掉,不知道可不可以?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.122.32.214
→
04/20 17:50, , 1F
04/20 17:50, 1F
→
04/20 17:50, , 2F
04/20 17:50, 2F
→
04/20 18:25, , 3F
04/20 18:25, 3F
→
04/21 16:58, , 4F
04/21 16:58, 4F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章