• 軟件測試技術
  • 軟件測試博客
  • 軟件測試視頻
  • 開源軟件測試技術
  • 軟件測試論壇
  • 軟件測試沙龍
  • 軟件測試資料下載
  • 軟件測試雜志
  • 軟件測試人才招聘
    暫時沒有公告

字號: | 推薦給好友 上一篇 | 下一篇

Testpartner 如何調用C++ dll

發布: 2008-4-23 18:26 | 作者: 網絡轉載 | 來源: 網絡轉載 | 查看: 339次 | 進入軟件測試論壇討論

領測軟件測試網 Testpartner 如何調用C++ dll Testpartner是一個非常容易上手的自動化測試工具。它的腳本語言VBA.所以功能上也是非常強大的. 很多人對VB都抱有一定的成見,認為其功能不強,用C++開發才是真材實料.不過這也是仁者見仁,智者見智.我覺得這就像是兩種武功一樣,vb就像是輕功,c++則是內功,各有所強.輕功的特點就是快,vb開發就是快,傳說中bill gates總能用vb解決其他人認為不可能用vb解決的問題。所以,對軟件應用的人來說技術的多樣性恰似條條大路通羅馬,我們就是要從中找出最近的那條. 最近,遇到個測試問題,業務上已經用C++來實現,為了能夠在最短的時間內使其能夠自動化,必須嵌入到TestPartner.這就涉及到如何在vb中調用C++代碼的問題。網上資料還是不少的,所以很快就完成了。其中的一個關鍵就是將C++的函數調用方式改成__stdcall.在vb中寫了個測試程序也通過了。但是相同的代碼嵌入到TestPartner,就出現了一個錯誤,“Bad dll calling convention”. 看了一下幫助,還是圍繞著函數調用方式這個問題。 Bad DLL calling convention (Error 49)

   

Arguments passed to a dynamic-link library (DLL) or Macintosh code resource routine must exactly match those expected by the routine. Calling conventions deal with number, type, and order of arguments. This error has the following causes and solutions: Your program is calling a routine in a DLL (in Windows) or a code resource (on the Macintosh) that's being passed the wrong type of arguments.

Make sure all argument types agree with those specified in the declaration of the routine you are calling.

Your program is calling a routine in a DLL (in Windows) or a code resource (on the Macintosh) that's being passed the wrong number of arguments.

Make sure you are passing the same number of arguments indicated in the declaration of the routine you are calling.

Your program is calling a routine in a DLL, but isn't using the StdCall calling convention.

If the DLL routine expects arguments by value, then make sure ByVal is specified for those arguments in the declaration for the routine.

Your Declare statement for a Windows DLL includes CDecl.

The CDecl keyword applies only to the Macintosh.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

 我明明是用了__stdcall,為什么還會有錯誤呢?再說了,相同的代碼在vb中也是可以被正常執行的.難道說Testpartner中的vb為非標準的vb?于是,我就想試一下其他的window api是否能夠被正常調用。copy了個sleep的聲明 Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Declare Function HelloWorld Lib "Test.dll" () 突然發現了一個與自己聲明不一致的地方,那就是我用了Function來聲明這個沒有返回值得函數。在vb中,沒有返回值得函數應該用sub. 于是改了一下,錯誤也就不在了。   看來,Testpartner的vb環境比標準vb IDE在語法上要求更嚴格!

文章來源于領測軟件測試網 http://www.anti-gravitydesign.com/

TAG: TestPartner Testpartner dll


關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備2023014753號-2
技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97