Solved

MSINET.OCX

Posted on 1998-10-11
3
527 Views
Last Modified: 2013-12-26
How do i use the MSInet controll in VB 5 or later?
0
Comment
Question by:Hanky368
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
mark2150 earned 50 total points
ID: 1487583
'
' Program to send a specific file to a web server using FTP protocol
' By: Mark M. Lambert on October 1, 1997
' Property of: US Department of Defense
'              US Navy/NAWCTSD
'
' V1.1 -  7 Oct 97 - MML - Clean up
' V1.0 -  1 Oct 97 - MML - Initial code
'
Private Sub Command1_Click()
'
' This is the file selector button
'
CommonDialog1.Filter = "HTML files (*.HTM)|*.HTM|All files (*.*)|*.*"
CommonDialog1.Flags = &H1000 + &H4  'File must exist and don't show R/O check
'
' Display control
'
CommonDialog1.ShowOpen
'
' Get selection
'
work = CommonDialog1.filename
'
' Validate response
'
If Len(work) > 0 Then
    Command2.Enabled = True
    Label2.Caption = work
    Label2.Tag = CommonDialog1.FileTitle
Else
    Command2.Enabled = False
    Label2.Caption = ""
    Label2.Tag = ""
End If
'
Refresh
End Sub

Private Sub Command2_Click()
'
' Here when transfer is requested
'
MousePointer = 11           'Busy cursor
htmname$ = Label2.Tag       'Get raw name
Wait.Label1.Caption = "Please wait," + vbCrLf + "Posting " + UCase$(htmname$) + vbCrLf + "to web page..."
Wait.Show                   'Show and update message
Wait.Refresh
'
' We don't have to open anything to get things rolling
' This executes the command
'
Call query("CD " + Inet1.Tag)     'Login and change to our directory
Call query("PUT " + Label2.Caption + " " + htmname$)    'Transfer file
Call query("CLOSE")         'Shut down connection
'
' Clean up after transfer
'
Command2.Enabled = False    'Turn off Send button
Label2.Caption = ""         'Clear last selection
Label2.Tag = ""
Wait.Hide                   'Get rid of wait
MousePointer = 0            'Restore mouse
End Sub

Private Sub Command3_Click()
'
' Shut down
'
Dim frm As Form
    For Each frm In Forms
        Unload frm
    Next frm
End
'
End Sub

Private Sub Form_Load()
'
' Startup initialization
'
Command2.Enabled = False        'Disable send button
Command1.Default = True         'File select is default
Label1.Caption = "Web Poster V1.1" + vbCrLf + "Copyright 1997" + vbCrLf + "US Navy/NAWCTSD"
Label1.FontBold = True
'
' Clear filename placeholders
'
Label2.Caption = ""             'Clear selection
Label2.Tag = ""
Show                            'Show screen
'
reload:
On Error GoTo needinit
'
Open "webpost.cfg" For Input As #1
Line Input #1, URL$
Line Input #1, user$
Line Input #1, pwd$
Line Input #1, homedir$
Close
On Error GoTo 0
'
' Warm up web links - we really need to have these be file based
'
Inet1.URL = URL$
Inet1.UserName = user$
Inet1.Password = pwd$
Inet1.Tag = homedir$
'
' Inet1.URL = "FTP://imdweb.ntsc.navy.mil"
' Inet1.UserName = ".r0bb1e.nawctsd"
' Inet1.Password = "imar0b0t"
'
Inet1.Protocol = icFTP
Inet1.RequestTimeout = 10
GoTo drain
' ==================
'
' Here when .CFG file is not found
'
needinit:
Resume needinit1
'
needinit1:
Close
On Error GoTo 0
Me.Hide
Init.Show vbModal
'
drain:
End Sub

Private Sub Label1_Click()
    Copyright.Show
End Sub
Public Sub query(cmd$)
'
' Subroutine to get data from web site.
'
' Call with:    INET.URL
'               INET.USERNAME
'               INET.PASSWORD
' all preset to appropriate values and the command you want executed in (cmd$)
'
' Perform indicated action
'
Inet1.Execute Inet1.URL, cmd$
'
' Wait for this command to complete
'
While Inet1.StillExecuting
    DoEvents
Wend
'
'Label1.Caption = "Response code: " + Str$(Inet1.ResponseCode) + vbCrLf + Inet1.ResponseInfo
'
vtData = Inet1.GetChunk(10240, icString)
'
drain:
End Sub


0
 

Author Comment

by:Hanky368
ID: 1487584
Send me the code! This mess does not help! I cant figure out all your controlls and forms. trmiller@fuse.net
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1487585
Its on my web page - www.hostpc.net/madmark
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now