Solved

MSINET.OCX

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

706 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

17 Experts available now in Live!

Get 1:1 Help Now