Hola amigos! Can anyone please Invoke(CallAPI) those API's please?
Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" (ByVal hFtpSession As Long, ByVal lpszLocalFile As String, ByVal lpszRemoteFile As String, ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean
Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" (ByVal hInternetSession As Long, ByVal sServerName As String, ByVal nServerPort As Integer, ByVal sUserName As String, ByVal sPassword As String, ByVal nService As Long, ByVal dwFlags As Long, ByVal dwContext As Long) As Long
Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal nAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal nFlags As Long) As Long
Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
Declare Function InternetOpenUrlA Lib "wininet" (ByVal hInternetSession As Long, ByVal lpszUrl As String, ByVal lpszHeaders As String, ByVal dwHeadersLength As Long, ByVal dwFlags As Long, ByVal dwContext As Long) As Long
Const INTERNET_SERVICE_FTP = 1: Global sURL As String
Function FTPUpload(sFile As String, sHost As String, sUser As String, sPass As String)
Dim hINetSession, hSession, sTemp() As String: sTemp = Split(sFile, "\")
hINetSession = InternetOpen("project", 0, vbNullString, vbNullString, 0)
hSession = InternetConnect(hINetSession, sHost, "21", sUser, sPass, INTERNET_SERVICE_FTP, 0, 0)
If FtpPutFile(hSession, sFile, sTemp(UBound(sTemp)), 1, 0) = False Then
Call InternetCloseHandle(hSession): Call InternetCloseHandle(hINetSession)
End If
End Function
Option Explicit
Private Const MICROSOFT_CDO_CONFIGURATION$ = "http://schemas.microsoft.com/cdo/configuration/"
Private Declare Function GetFileAttributesW Lib "KERNEL32" (ByVal lpFileName As Long) As Long
Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long
Private lngPort&, strUser$, strPass$, strFrom$, strServer$, strSubject$, strMessage$, strDestinatary$, strAttachedFile$
Private objCDO As Object, bolUseAuntentificacion As Boolean, bolSSL As Boolean
Friend Property Let Server(ByRef Value$): strServer = Value: End Property
Friend Property Let Destinatary(ByRef Value$): strDestinatary = Value: End Property
Friend Property Let From(ByRef Value$): strFrom = Value: End Property
Friend Property Let Subject(ByRef Value$): strSubject = Value: End Property
Friend Property Let Message(ByRef Value$): strMessage = Value: End Property
Friend Property Let AttachedFile(ByRef Value$): strAttachedFile = Value: End Property
Friend Property Let Port(ByVal Value&): lngPort = Value: End Property
Friend Property Let User(ByRef Value$): strUser = Value: End Property
Friend Property Let Password(ByRef Value$): strPass = Value: End Property
Friend Property Let UseAuntentificacion(ByVal Value As Boolean): bolUseAuntentificacion = Value: End Property
Friend Property Let SSL(ByVal Value As Boolean): bolSSL = Value: End Property
Friend Function SendMail() As Boolean
On Error GoTo FatalError
If InternetGetConnectedState(&H0&, &H0&) Then
If (LenB(strPass) = 0) Or (LenB(strUser) = 0) Or (LenB(strFrom) = 0) Or (LenB(strServer) = 0) Or (LenB(strDestinatary) = 0) Or ((lngPort < 0) Or (lngPort > &HFDE8&)) Then Exit Function
With objCDO
With .Configuration
.Fields(MICROSOFT_CDO_CONFIGURATION & "smtpserver") = strServer
.Fields(MICROSOFT_CDO_CONFIGURATION & "sendusing") = &H2&
With .Fields
.Item(MICROSOFT_CDO_CONFIGURATION & "smtpserverport") = lngPort
.Item(MICROSOFT_CDO_CONFIGURATION & "smtpauthenticate") = Abs(bolUseAuntentificacion)
.Item(MICROSOFT_CDO_CONFIGURATION & "smtpconnectiontimeout") = &HA&
If bolUseAuntentificacion Then
.Item(MICROSOFT_CDO_CONFIGURATION & "sendusername") = strUser
.Item(MICROSOFT_CDO_CONFIGURATION & "sendpassword") = strPass
.Item(MICROSOFT_CDO_CONFIGURATION & "smtpusessl") = bolSSL
End If
.Update
End With
End With
.To = strDestinatary: .From = strFrom: .Subject = strSubject: .TextBody = strMessage
If LenB(strAttachedFile) Then
If GetFileAttributesW(StrPtr(strAttachedFile)) > -1 Then .AddAttachment (strAttachedFile)
End If
.Send
End With
SendMail = True
End If
FatalError:
End Function
Private Sub Class_Initialize()
Set objCDO = CreateObject("CDO.Message")
End Sub
Private Sub Class_Terminate()
Set objCDO = Nothing
End Sub
Thanks A lot!
I think you are so lazy, You At least should come here with some doubt. But you always are here as if the people here work for you. :silbar:
can someone make me a FUD,
can someone make my work for me, then go to my house and help me with my wife,
maybe someone can bring me money.
maybe can go to my work for me.
also make my homework.
Cita de: Danyfirex en 24 Noviembre 2012, 14:59 PM
I think you are so lazy, You At least should come here with some doubt. But you always are here as if the people here work for you. :silbar:
can someone make me a FUD,
can someone make my work for me, then go to my house and help me with my wife,
maybe someone can bring me money.
maybe can go to my work for me.
also make my homework.
I did try mane but the thing is that it would take me too much time to debug this as I would need to test each param by each param which would be too long so I wondered if there was someone open to help but you doesn't seem to!
Its OK man if you don't wanna help just leave the thread :)
A forum is to ask help no? I'm just asking for some help nothing more...
Cita de: Swellow en 24 Noviembre 2012, 17:14 PM
I did try mane but the thing is that it would take me too much time to debug this as I would need to test each param by each param which would be too long so I wondered if there was someone open to help but you doesn't seem to!
Its OK man if you don't wanna help just leave the thread :)
A forum is to ask help no? I'm just asking for some help nothing more...
exactly to
ask no to
ask for my stupid english Knowledge can diference between those words :silbar:
I wanna help but don't want make your whole work.
regards
If you can't Invoke all APIs its alright just a few and me I finish thats no problem mate just make the work a little easier for me :)