Çë½Ì£ºVBµ÷ÓÃVC dll ±¨´í - .NET¼¼Êõ / VB.NET
VCÖеĵ¼³öµÄº¯ÊýÊÇÕâÑùµÄ£º
extern "C" __declspec(dllexport)
HRESULT Connect(LPCSTR IpAddr, CHAR* pcUserName = NULL, CHAR* pcPassword = NULL)//·µ»Ø0±íʾÁ¬½Ó³É¹¦£¬·Ç0Ôòʧ°Ü
{
...
}
ÎÒÔÚVBÖÐÉùÃ÷ÈçÏ£º
Declare Function Connect Lib "C:\example.dll" (ByVal IpAddr As String, ByVal UserName As String, ByVal Passwd As String) As Integer
ͬʱ£¬ÎÒ¶¨Òå
Const NULL = 0
È»ºóµ÷Óãº
Dim result As Integer
result = Connect("138.139.0.230", NULL, NULL)
If result <> 0 Then
MsgBox("error_connect")
Return
End If
½á¹û×ÜÊDZ¨´í£¬ÇëÎÊÄÄÀï²»¶ÔÄØ£¿
Const NULL = Nothing
±¨´íÐÅÏ¢ÊÇʲô£¿
¿´Ï£º
result = Connect("138.139.0.230", nothing, nothing)
result = Connect("138.139.0.230", String.Empty, String.Empty)£¿
ÓÃnothingÊÔ¹ýÁË£¬»¹ÊDz»ÐУ¬±¨´í¾ÍÊÇ˵ result ²»µÈÓÚ0
½øÈëµ½ MsgBox("error_connect")
String.EmptyÒ²ÊÔ¹ýÁË£¬·µ»ØÖµÒ²·Ç0¡£
°ÑºóÁ½¸ö²ÎÊýµÄByVal¸Ä³ÉByRefÒ²²»ÐС£¡£¡£
result = Connect("138.139.0.230", NULL, NULL)
-----------
Ä㿴һϣ¬Ëü·µ»ØµÄ²»ÊÇ0£¬·µ»ØµÄ¾ßÌåÊǸöʲô¶«Î÷£¿µ÷ÊÔһϻòÕßÖ±½Ó°É½á¹ûMsgBox³öÀ´
·µ»ØµÄ¾ÍÊÇÒ»¸ö¸ºÖµ£º-1071579135
ÎÒÓÃVCдµÄ³ÌÐòµ÷ÓÃÕâ¸öConnectº¯Êý£º
HRESULT result
Ïà¹ØÎÊ´ð£º
Ϊʲô¹¤¾ßÀ¸°´Å¤µÄ¿í¶È¸Ä±ä²»ÁË,ÔÚÊôÐÔÀï¸ÄÁËÓÖ±ä³ÉÔÀ´µÄÊýÖµÁË
´óºú×ÓÕæÀ÷º¦£¬»Ø´ð»ù±¾¶¼ÊDZ¬Áϼ¶µÄ
´óºú×ÓÉý¼¶Õæ¿ì°¡£¬Õâ²Å¼¸Ìì¾Í5Ìõ¶Ì¿ãÍâ¼ÓÔÂÅÅÃûµÚÒ»ÁË
ÏëÏëÎÒÕâ5¸ö¶Ì¿ã»ìÁ˲¶à8Äê²ÅµÃµ½µÄ¡£
»Ø¸´ ......
ÎÒÔÚÀàÖÐÓÐÒ»¸öº¯Êý
Public Function DownloadAdditionalSite(SiteName As siteconfig, Directory As String, ymd As String) As Boolean
siteconfigÊÇÎÒ×Ô¶¨ÒåÀàÐ͵ÄÊý¾Ý£¬ÎªÊ²Ã´»áÌáʾ¡°Ö»ÓÐÔÚ¹«¹²¶ÔÏóÄ£¿éÖж ......
ÎÒÏë°ÑwordÁí´æÎªxmlÖ®ºó£¬ÓÃvb¶ÁÈ¡Õâ¸öxmlµÄÄÚÈÝ£¬ÇëÎÊÈçºÎʵÏÖ£¿
dim f as integer
dim b() as byte
dim s as string
dim L as long
f=freefile()
open "abc.xml" for binary access read as #f
......
ÏÖÔÚÓиöxmlÎļþÊÇ<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xm ......
ͦ·±Ëö£¬Ö®Ç°·¢µÄÌû×Ó£¬·Öֵ̫µÍÏÖÔÚÖØ·¢Ò»¸ö¡£»¶Ó¸÷λ´óÏÀ~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[] ......