Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MSINET.OCX

Posted on 1998-10-11
3
Medium Priority
?
606 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 100 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

972 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