Solved

Looking for DLL version of Inet OCX?

Posted on 2002-07-23
12
1,184 Views
Last Modified: 2007-11-27
Is there a DLL version of the Visual Basic Inet OCX control.

I have written a DLL using using Microsofts Inet OCX.
My DLL uses Inet.Execute method to POST some XML to a secure site. It then awaits a successful response in the Inet_Statechanged event.

My problem is when i put my DLL into production it occasionally falls over for no aparent reason.

The only other external control or library I use is the ccrpTimer to capture timeouts, but I doubt this is anything to do with the problem.

I want to find either a DLL version of the Inet OCX or else I need to find out if I can Achieve the same using API calls.

My DLL will reside on NT4 server with IIS4 and is called from an ASP page. Its is not using MTS as its not present on the server.

The Inet OCX seems to be the root of my problems.
All help appreciated.
0
Comment
Question by:diarmaid
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 3

Expert Comment

by:daffyduck14mil
ID: 7171516
Hi,

There is a control that has all the API functions of the Winsock API wrapped up. It can be used like the Inet.OCX, only it has been tried and tested under NT.

http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=9996&lngWId=1

Grtz.©

D.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7172007
The Internet Transfer Control is a wrapper for the Wininet.dll.  However, what you are contemplating is not trivial and for the most part counter-productive (I know, I have done it) you are better off purchasing a good third party control.

If you do insist in going down this path, let me know and I can post some additional info to get you started.

Anthony
0
 
LVL 2

Author Comment

by:diarmaid
ID: 7172209
daffyduck14mil
I have looked at the code from the link and am unsure if its what im looking for. It looks like going from using one OCX to using another OCX.

acperkins
I was looking at using the wininet.dll directly. What my DLL does is relatively simple but it has to be very reliable.

It gets called from an ASP page, and contains only one class module.
The DLL reads a text file (containing XML) from the server it resides on into a variable, lets say txtvar. It then posts this to a redirector which uses it to check other servers and receives an XML response back which it parses and validates.
In stateChanged if Error (icError) it sets return string to the error message. If successful (icResponseCompleted) it parses and validates the XML and sets the return string to the appropriate value.
The return string is then handed back to the calling ASP page.

I am also using ccrpTimer to catch timeouts and handle them. (from what i have researched this seems to be a very stable timer for apps/DLLs like this one)

I am using my own initialize and terminate functions which are explicitly called instead of VBs class events to rule out any problems there.

Here is a cut down version of the code Im using.
As you can see it is a fairly simple DLL. Reliability is my only problem.  There are only a few hundread lines of code altogether and the only external objects used are the ccrpTmr6.dll and the Inet.ocx.
I also have error handling in the DLL which writes to a log file on the server but there are no errors in it. Also the INETINFO service had to be killed and the WWWPublishing services restarted on the server to get the DLL working again.

The only other thing I can think it may be is problems with IIS4 on the server.

'cut down code
function calledfunction()
  Initialize  
  finished = false
  Inet.Cancel
 
  processfunction
 
  do while not finished
    doevents
  loop
 
  calledfunction = return_string  
  terminate
end function

sub processfunction()

  Inet.protocol = icHTTPS
  Inet.Execute "https://sitename/redirector", "POST", txtvar, header

end sub

sub Inet_StateChanged(ByVal State As Integer)

  select case state
  case icerror '(11)
    return_string = "relevent message"
    finished = true

  case icresponsecompleted '(12)
    'parse received xml and validate
    'set the return_string
    return_string = "relevent message"
    finished = true
 
  end select

end sub

Many Thanks in advance
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7172439
Here are some links, that should get you started using WinInet:
SAMPLE: Using FTP WinInet APIs in Visual Basic with SimpleFtp
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q195653&
INFO: Limitations of Internet Transfer Control
http://support.microsoft.com/default.aspx?scid=KB;EN-US;q233037&
SAMPLE: Vbhttp.exe Demonstrates How to Use HTTP WinInet APIs in Visual Basic
http://support.microsoft.com/default.aspx?scid=KB;EN-US;q259100&

But I strongly urge you to re-consider. Besides, if you are using XML why not use the XMLHTTP (previously called XMLHTTPRequest) object or the ServerXMLHTTP, this is exactly what it was designed for and is trivial to implement?

Incidently XMLHTTP uses WinInet (the same as the Internet Transfer Control) and ServerXMLHTTP is designed for server applications and relies on a new HTTP client stack, WinHTTP.

Let me know if you need an example of XMLHTTP,
Anthony
0
 
LVL 2

Author Comment

by:diarmaid
ID: 7176924
acperkins

I have looked at your provided samples and i agree that it will not be a trivial task. hopefully i wont have to take that route.

You mentioned purchasing a good third party control for the job. Could you recomend a few good controls that would suit my task?

My other option is to try and delegate it to someone else to write in C++ (probably a no-go).

Thanks
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7177661
Check out Mabry's FTP/X control, I have used it in the past and it works very well.  Here is the link:
http://www.mabry.com/ftpx/index.htm

By the way, it is significantly more expensive than when I purchased it 3 years ago.  But you can download and evaluate before buying it.

Anthony
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 2

Author Comment

by:diarmaid
ID: 7821221
I ended up using the OCX through code in the endup, i got rid of it completly and told them to rewrite it using C++, its what should have been done in the first place.
Thanks.
0
 
LVL 2

Author Comment

by:diarmaid
ID: 7821257
I want to delete this question, but id also like to reduce the points to 100 and give to acperkins for the help i received, I didnt use it but the advice was good none the less.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7821705
>>I want to delete this question, but id also like to reduce the points to 100 and give to acperkins for the help i received, I didnt use it but the advice was good none the less. <<
Post a message in Community Support at http://www.experts-exchange.com/Community_Support/ to this effect.

Anthony
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7824277
If there are no objections within 72 hours I will

  PAQ and refund

** Mindphaser - Community Support Moderator **
0
 
LVL 2

Author Comment

by:diarmaid
ID: 7828402
acperkins,

Please follow link and post comment to receive points.
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20485146.html

Thanks.
0
 
LVL 6

Accepted Solution

by:
Mindphaser earned 0 total points
ID: 7879333
Points refunded and moved to PAQ

** Mindphaser - Community Support Moderator **

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…

760 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

18 Experts available now in Live!

Get 1:1 Help Now