|
VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
|
上一篇主題 :: 下一篇主題 |
發表人 |
內容 |
55812296
註冊時間: 2012-09-19 文章: 49
第 1 樓
|
發表於: 星期五 十二月 20, 2013 5:06 pm 文章主題: 請教Declare dll |
|
|
Define Class WinctDll As Session OlePublic
Procedure Cut_0
Lparameters no,sw,TnDot
.........
我將以上編成 winctdll.dll 並run regsvr32 winctdll.dll
並以如下程式碼啟動
Declare integer Cut_0 In WinctDll.dll ;
number ,number ,number
Cut_0(10.000,1,2)
錯誤訊息如下
cannot find entry point Cut_0 in dll (error 1754)
The dynamic-link library (DLL) entry point that you have declared is invalid. Check both the name of the entry point and the name of the DLL.
我知道DLL函示名稱 有分大小寫 Cut_0 也沒錯 請教先進何處節點錯了 |
|
回頂端 |
|
|
spfrk
註冊時間: 2004-11-08 文章: 161
第 2 樓
|
發表於: 星期五 十二月 20, 2013 7:06 pm 文章主題: |
|
|
VFP 所產生的 DLL 並非 WINDOWS NATIVE DLL, 因此無法使用一般的呼叫方式,而必須以物件的方式來使用, 以前我也不知道,因為最近寫電子發票證明聯的
DLL 來發現這個問題, 使用方式如下:
*/ for VB6
*/
*/ Dim oInvPrn As Object
*/ Set oInvPrn = CreateObject("Elcinv.EposElcInv")
*/ vsta = oInvPrn.ElcInv(1, 0, 0, "4:7:0:1:0", "10207", "AZ12345000", "1234", "66886688", "80692814", "23698115", 166, "葡萄柚綠茶:1:30:葡萄柚紅茶:1:300", "宜普科技 發財店 0927-217786")
*/ vok = MsgBox("列印機狀態 " + CStr(vsta), 36, "訊息確認")
*/
*/ for VB 2008
*/
*/ Dim oInvPrn As Object
*/ Dim vsta As Integer
*/ Dim vok As Integer
*/
*/ oInvPrn = CreateObject("Elcinv.EposElcInv")
*/ vsta = oInvPrn.ElcInv(1, 0, 0, "4:7:0:1:0", "10207", "AZ12345000", "1234", "66886688", "80692814", "23698115", 166, "葡萄柚綠茶:1:30:葡萄柚紅茶:1:300", "宜普科技 發財店 0927-217786")
*/ vok = MsgBox("列印機狀態 " + CStr(vsta), 36, "訊息確認")
*/
*/ C++ Builder 未測試
*/ Variant a = CreateOleObject("Elcinv.EposElcInv");
*/ a.ElcInv(1, 0, 0, "4:7:0:1:0", "10207", "AZ12345000", "1234", "66886688", "80692814", "23698115", 166, "葡萄柚綠茶:1:30:葡萄柚紅茶:1:300", "宜普科技 發財店 0927-217786");
*/
*/ VC++ 未測試
*/ #import "C:\WINDOWS\SYSTEM32\elcinv.dll" no_namespace
*/
*/ LPCLSID clsid;
*/ CLSIDFromProgID(OLESTR("Elcinv.EposElcInv"),&clsid);
*/ CComPtr<IGetRes> pGetRes;
*/ pGetRes.CoCreateInstance(clsid);
*/ pGetRes->ElcInv(1, 0, 0, "4:7:0:1:0", "10207", "AZ12345000", "1234", "66886688", "80692814", "23698115", 166, "葡萄柚綠茶:1:30:葡萄柚紅茶:1:300", "宜普科技 發財店 0927-217786");
*/ pGetRes.Release();
*/ CoUninitialize();
*/
*/for C# 未測試
*/
*/public void ElcInvPrn
*/ {
*/ System.Type oType = System.Type.GetTypeFromProgID("Elcinv.EposElcInv");
*/
*/ object oInvPrn = System.Activator.CreateInstance(oType);
*/ vsta = oType.InvokeMember("ElcInv", System.Reflection.BindingFlags.InvokeMethod, null, oInvPrn, new object[] {1,0,0,"4:7:2:1:0","10207","AZ12345002","9012","66886688","80692814","23698115",166,"葡萄柚綠茶:1:30:葡萄柚紅茶:1:30:烏龍柚香茶:1:1000:烏龍百香茶:1:1000","宜普科技 發財店 0927-217786"});
*/ }
oInvPrn = NEWOBJECT("Elcinv.EposElcInv") && DLL 檔名 + CLASS
vsta = oInvPrn.elcinv(1,0,0,"4:7:0:1:0:1","10207","AZ12345000","1234","66886688","80692814","23698115",166,"葡萄柚綠茶:1:30:葡萄柚紅茶:1:300","宜普科技 發財店 0927-217786")
MessageBox("列印機狀態"+str(vsta,4), 36, "訊息確認") |
|
回頂端 |
|
|
|
|
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
|
|