用VB创建FTP组件(get)

本文介绍了一种使用PInvoke进行FTP连接时遇到的不平衡堆栈问题,并提供了具体的VB.NET代码示例。通过检查PInvoke签名与目标未托管签名之间的匹配情况,可以定位并解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 Const INTERNET_FLAG_PASSIVE = &H8000000 ' used For FTP  connections
        Const PassiveConnection As Boolean = True

        Dim sProxyName As String = "Ftp=ftp://Proxy1:21?"

        Dim sProxyBypass As String = "ov*?"

        Dim sAgent As String = "FTP Control"

        Dim strServer As String, strUser As String, strPassword As String

        strServer = "177.188.0.100"

        strUser = "FTPUSER"

        strPassword = "200803"

        Dim lngINet As Integer = InternetOpen(sAgent, 1, sProxyName, sProxyBypass, 0)

        Dim lngINetConn As Integer = InternetConnect(lngINet, strServer, 0, strUser, strPassword, 1, IIf(PassiveConnection, INTERNET_FLAG_PASSIVE, 0), 0)

        Dim blnRC As Boolean = FtpGetFile(lngINetConn, "dirmap.txt", "c:/dirmap.txt", 0, 0, 2, 0) 

 

出现下面问题应该怎么解决:

A call to PInvoke function 'WindowsApplication1!WindowsApplication1.Form1::InternetOpen' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值