Solved

MSINET.OCX

Posted on 1998-10-11
3
542 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

776 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