Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MSInet Control on DHTML Page doesn't load.....

Posted on 2003-10-21
9
Medium Priority
?
309 Views
Last Modified: 2013-11-13
I have a DHTML project that includes the MSInet control. When I run the project on either of 2 development systems (Win2K, WinXP), it works fine. When I create an Install Set and install it on another PC, the MSINet control just appears as an empty box. In the design environment, the MSINet control is not even visible on the page, but at run time there is an empty box.

Any idea as to what I'm doing wrong?


-konfused karl

0
Comment
Question by:kfrick
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 2000 total points
ID: 9593169
ouch, just a q: why do you use that control on a web page?
0
 
LVL 3

Author Comment

by:kfrick
ID: 9593388
Perhaps this is the problem all along......maybe I'm juts going about this wrong!

Here's the scoop: An industrial scale indicator exposes an FTP area on our network. The scale can read and write files in this area. A group of files define the scale's setup.

A browser-based way of administering thee files is desired.

I am attempting to use the INet control to read the files from the scale to local files. I then use VB code populate the text input boxes on my DHTML page with the contents of the various files. The user can edit data, click SUBMIT, and VB code will move the data from the text input boxes to the files, and FTP the files to the scale.

Now, all this works on the 2 development machines. But the INet control never appears on other machines on which I have tested the installation.

Maybe I should NOT be trying to use the MSINet control on the page? How else might you go about this? I'm open for suggestions....

-karl
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9593479
Well, since it works on other machines, please verify is msinet.ocx is installed on those machines that fails.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:kfrick
ID: 9593654
Well, the PDW includes MSINET.OCX for distribution in the install set.......I have a feeling it's something to do with starting an instance of MSINet at run-time, rather than installing it on the DHTML page......Hmmmmmm......

-karl
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9593754
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9593806
some background:
from devx.site (link no longer available)

WinInet API Programming
By Matthew Arnheiter

Visual Basic applications are becoming more connected, and developers are trying to Web-enable their applications by supporting HTTP or FTP. Often this requires using the Microsoft Internet Transfer control or a third party control, but all of the functionality can be achieved through the use of the WinInet API without the need of a form to host the control.


This solution will present the FTP functionality of the WinInet API and provide a wrapper to this API so that you can easily add FTP support to your applications.

Built into Windows are several APIs that allow you to develop rich networking applications. Two that are available to Visual Basic developers are the Win32 Internet API (WinInet) and the WinSock API. These two APIs are encapsulated in the Microsoft Internet Transfer control and the Winsock control, but they do not offer all of the flexibility that working with the API does.

The WinInet API was designed to abstract three Internet protocols, HTTP, FTP, and Gopher; making it easier for developers to build Internet-enabled applications. WinInet exposes many functions for Web-enabling your applications. Some of the functions that exist in the API are:


InternetConnect - Opens a FTP, Gopher, or HTTP session to a given site.
InternetReadFile - Reads data from a handle on a site.
InternetWriteFile - Writes data to an open Internet file.
FTPGetFile - Retrieves a file from a FTP site and saves it locally.
FTPRenameFile - Renames a file on a FTP site.

Now let's go into detail on the FTP functions that the WinInet API exposes and create a wrapper class to allow you to easily add FTP support without the use of ActiveX controls.
FTP API Functions
The WinInet API exposes 12 functions that allow developers to manipulate and navigate files and directories on a FTP site. In addition there are several functions that provide session management for opening and closing handles to a site. When working with the WinInet API, there is a sequence of events that occur over an over. This sequence is:

1. Initialize the WinInet API by calling the InternetOpen function
2. Connect to a site and retrieve a handle to the open connection by using the InternetConnect function
3. Navigate through the site and manipulate files and directories
4. Close the connection

To make this more concrete, let's download a file from Microsoft's FTP site using the WinInet API. The code for downloading ls-lr.zip from the root directory would be:


    hInternet = InternetOpen("DevX Sample", _
INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, _
INTERNET_FLAG_NO_CACHE_WRITE)
    hConnect = InternetConnect(hInternet, "ftp.Microsoft.com", _
INTERNET_DEFAULT_FTP_PORT, _
            "", "", INTERNET_SERVICE_FTP, _
            INTERNET_FLAG_EXISTING_CONNECT Or INTERNET_FLAG_PASSIVE, _
&H0)
    lRes = FtpGetFile(hConnect, "ls-lr.zip", "c:\ls-lr.zip", _
False, FILE_ATTRIBUTE_ARCHIVE, _
            FTP_TRANSFER_TYPE_UNKNOWN, 0&)
    lRes = InternetCloseHandle(hConnect)
    lRes = InternetCloseHandle(hInternet)

To get a better understanding of what is happening, let's take a closer look at each function.

InternetOpen
The first function to be called is the InternetOpen function. This initializes the internal state of the WinInet API. The declaration of the InternetOpen method is:
Public Declare Function InternetOpen Lib "wininet.dll" _


 
   Alias "InternetOpenA" _
  (ByVal lpszAgent As String, _
   ByVal dwAccessType As Long, _
   ByVal lpszProxyName As String, _
   ByVal lpszProxyBypass As String, _
   ByVal dwFlags As Long) As Long

The following table describes each of the parameters.

Parameter Description
lpszAgent Sets the user agent string that is passed to the server during each call.
dwAccessType Determines what access will be used, either direct connection or through a proxy.
lpszProxyName Lists the names of the proxy servers to use.
lpszProxyBypass Lists the names of clients that should not use a proxy server.
dwFlags Flags for setting asynchronous requests and caching support.
Table 1: Parameters for the InternetOpen function

InternetOpen returns a handle that is used in subsequent calls into the WinInet API. You will only have to call this function once and store the handle in a variable.

InternetConnect
After initializing the WinInet DLL, you must retrieve a handle to an FTP session. This is accomplished using the InternetConnect function. The handle that you receive will be used in all of the subsequent calls to manipulate files and directories and navigate through the FTP site. The InternetConnect function is passed connection information like the site you are connecting to and the user's name and password. In addition, the type of connection is specified. In the following case we are opening a FTP session:


 
  hConnect = InternetConnect(hInternet,
      "ftp.Microsoft.com", INTERNET_DEFAULT_FTP_PORT, _
            sUserName, sPassword, INTERNET_SERVICE_FTP, _
            INTERNET_FLAG_EXISTING_CONNECT Or INTERNET_FLAG_PASSIVE, &H0)

With the connection handle you can start manipulating file and directories on the FTP site.


FTP Functions
The WinInet API exposes several functions that allow you to manipulate files and directories and to navigate through a FTP site. The following table lists all of the functions.

Function Description
FtpCreateDirectory Creates a new directory on the FTP site
FtpGetCurrentDirectory Retrieves the current directory
FtpRemoveDirectory Deletes a directory and all sub items from the FTP site
FtpSetCurrentDirectory Changes the current directory  
FtpDeleteFile Deletes a file from the FTP site
FtpFindFirstFile Searches the current directory of a FTP site for files and subdirectories
FtpGetFile Downloads a file from a FTP site to the local machine
FtpGetFileSize Retrieves the size of a file from the FTP site
FtpOpenFile Opens a handle to a file on the FTP for reading and writing
FtpPutFile Uploads a file to the FTP site
FtpRenameFile Renames a file on the FTP site
FtpCommand Provides an interface for sending FTP commands to the FTP server
Table 2: FTP functions within the WinInet API

All of these functions take a handle to an Internet connection and specific information on the file or directory to manipulate. All of the declarations for these functions can be found in the WinInetAPI.bas file in the source code.

WinInet FTP Class
As with most APIs it is often easier to think about and work with the API if it is wrapped in a class module. The accompanying source code contains one class module that exposes the FTP functionality of the WinInet API. By encapsulating the functionality within a class module, most of the details of the underlying API can be removed from client application. To demonstrate this, we will download the same ls-lr.zip from Microsoft's FTP site:


 
    Dim oFTP As New clsFTP
   
    oFTP.OpenConnection "ftp.Microsoft.com", "", "", ""
    oFTP.DownloadFile "ls-lr.zip", "C:\"
    oFTP.CloseConnection
   
    Set oFTP = Nothing

The class can be used to perform most interactions with an FTP site such as navigating through the directory structure, enumerating files and directories, and manipulating the file and directories. You can download the code by clicking here.

Limitations of WinInet
The WinInet API was not designed to scale for high-stress, high-volume server environments. It was designed to provide FTP, HTTP, and Gopher functionality for Internet Explorer. Because it was designed as a client application, the uses registry values contained in the HKEY_CURRENT_USER hive are not available if you are running the WinInet API from NT services such as IIS. In addition, the WinInet API limits the number of concurrent connections to a single server to just two connections. This is in agreement with the HTTP specification. To accomplish networking tasks on a server you will need to use the WinSock API or third party components that were designed for this task.

0
 

Expert Comment

by:eliaslopezgtz
ID: 9595238
try updating the ie to the same version in the machine it was created and then ... check that msinet.ocx is correctly registered and working... do some tests... with a small app with only the msinet and a messagebox...

good luck
0
 
LVL 27

Expert Comment

by:planocz
ID: 10119687
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
No response from kfrick from 10/21/2003 comment
Award points to Richie_Simonetti is recommend.
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

planocz
EE Cleanup Volunteer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

670 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