Solved

MSINET.OCX

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

820 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