如题所述
å¨VBéé¢âå·¥ç¨âèåä¸é¢æ·»å âæ·»å 模åâï¼æå¼å¯¹è¯æ¡ï¼æ¾å°è·¯å¾ï¼X:\Program Files\lingo80\Dllï¼X为驱å¨çï¼ä¸çâLingd80.basâï¼æ·»å å°VBä¸ã
å¨VBçé¢ä¸è®¾è®¡Text1åText2ãCommand1ã
ç¼åè¯å¥ï¼
Private Sub Command1_Click()
'------------------------
Dim nError As Long
Dim pLINGO As Long
Dim nPointersNow As Long
Dim cScript As String
Dim Apppath As String
Dim dStatus As Double
Apppath = "take" & Space(1) & Right(App.Path, Len(App.Path) - 2)
'------------------------
On Error GoTo ERROREXIT
pLINGO = LScreateEnvLng()
'------------------------
Dim x As Double, y As Double
x = Text1.Text
'------------------------
nError = LSsetPointerLng(pLINGO, x, nPointersNow)
nError = LSsetPointerLng(pLINGO, y, nPointersNow)
'------------------------
On Error GoTo ERROREXIT
nError = LSexecuteScriptLng(pLINGO, cScript)
'------------------------
dStatus = -1#
nError = LSsetPointerLng(pLINGO, dStatus, nPointersNow)
'------------------------
cScript = "SET ECHOIN 1" & Chr(10)
cScript = cScript & Apppath & "\LINGO1.lng" & Chr(10)
cScript = cScript & "GO" & Chr(10)
cScript = cScript & "QUIT" & Chr(10)
cScript = cScript & Chr(0)
On Error GoTo ERROREXIT
nError = LSexecuteScriptLng(pLINGO, cScript)
'------------------------
LScloseLogFileLng (pLINGO)
LSdeleteEnvLng (pLINGO)
'------------------------
Text2.Text = y
ERROREXIT:
End Sub
ç¶ååç¨lingo8.0ç¼å代ç ï¼å½å为LINGO1.lngï¼æ³¨æè¦ä¿å为.lngæ件ï¼ï¼
model:
data:
x=@pointer(1);
enddata
y=x*2;
data:
@pointer(2)=y;
enddata
end
å°.lngæ件åVB代ç æ¾åä¸æ件夹ï¼å³å¯è¿è¡VBæ§å¶Lingoçè¾å ¥ï¼æ¬ç¨åºæ¯ç±VBçText1è¾å ¥xï¼ç±lingoå®æy=2x计ç®ï¼è®¡ç®ç»æè¿åå°VBä¸Text2ï¼ã
å¨VBçé¢ä¸è®¾è®¡Text1åText2ãCommand1ã
ç¼åè¯å¥ï¼
Private Sub Command1_Click()
'------------------------
Dim nError As Long
Dim pLINGO As Long
Dim nPointersNow As Long
Dim cScript As String
Dim Apppath As String
Dim dStatus As Double
Apppath = "take" & Space(1) & Right(App.Path, Len(App.Path) - 2)
'------------------------
On Error GoTo ERROREXIT
pLINGO = LScreateEnvLng()
'------------------------
Dim x As Double, y As Double
x = Text1.Text
'------------------------
nError = LSsetPointerLng(pLINGO, x, nPointersNow)
nError = LSsetPointerLng(pLINGO, y, nPointersNow)
'------------------------
On Error GoTo ERROREXIT
nError = LSexecuteScriptLng(pLINGO, cScript)
'------------------------
dStatus = -1#
nError = LSsetPointerLng(pLINGO, dStatus, nPointersNow)
'------------------------
cScript = "SET ECHOIN 1" & Chr(10)
cScript = cScript & Apppath & "\LINGO1.lng" & Chr(10)
cScript = cScript & "GO" & Chr(10)
cScript = cScript & "QUIT" & Chr(10)
cScript = cScript & Chr(0)
On Error GoTo ERROREXIT
nError = LSexecuteScriptLng(pLINGO, cScript)
'------------------------
LScloseLogFileLng (pLINGO)
LSdeleteEnvLng (pLINGO)
'------------------------
Text2.Text = y
ERROREXIT:
End Sub
ç¶ååç¨lingo8.0ç¼å代ç ï¼å½å为LINGO1.lngï¼æ³¨æè¦ä¿å为.lngæ件ï¼ï¼
model:
data:
x=@pointer(1);
enddata
y=x*2;
data:
@pointer(2)=y;
enddata
end
å°.lngæ件åVB代ç æ¾åä¸æ件夹ï¼å³å¯è¿è¡VBæ§å¶Lingoçè¾å ¥ï¼æ¬ç¨åºæ¯ç±VBçText1è¾å ¥xï¼ç±lingoå®æy=2x计ç®ï¼è®¡ç®ç»æè¿åå°VBä¸Text2ï¼ã
温馨提示:答案为网友推荐,仅供参考