Solved

Call a VB Exe from a web page

Posted on 2004-08-11
18
1,246 Views
Last Modified: 2008-02-01
I have created a VB exe that I would be storing in the server where I have hosted my site. Through a link from a asp page, I want the user to open that exe and pass some values to it. The exe will then perform some actions based upon those values and return the result to the user. Is this possible?

I forsee the following problems:
1. being an exe the IIS settings may not allow it to run on the server.
2. How can the user interact with the exe through a browser. possibly the browser will ask the user to download the exe at his/her machine.

Please advise.
0
Comment
Question by:Sethi
[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
  • 6
  • 5
  • 3
  • +3
18 Comments
 
LVL 36

Assisted Solution

by:Zyloch
Zyloch earned 100 total points
ID: 11775150
Hi

I don't thinks so, at least not in IE. There are strict security regarding these things, otherwise viruses would be able to go everywhere. The only thing I can see if for the user to download it, or create something like the exe in ASP, for instance.

Regards,
Zyloch
0
 
LVL 14

Expert Comment

by:Matti
ID: 11775330
Why don't you make it as a ActiveX control.
If it's a single form program, it might be easy to convert as a control.

Matti
0
 
LVL 18

Author Comment

by:Sethi
ID: 11775430
The application involves many forms and can not be made an ActiveX. Infact as I am not very good with ActiveX Controls, I would not like to venture into them at this stage of the project. There are approximately 10 forms in the application and the application.
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 17

Expert Comment

by:inthedark
ID: 11775452
There are a number of ways:

Internet

1) Normally you would change the type of you project from a Standard EXE to an ActiveX DLL.  You make a public class that activaes your application. You create a little ASP paqe that creates an instance of your object.  You can then pass to your application the IIS objects that make life easy: Application, Session, Request & Response objects which are easy to use, that tell you what the client has ask for. You then send the clinet information via the response object.  It sounds hard but it is as easy as this:

response.write "<HTML><BODY>Hello World</BODY></HTML>

2) You can create a CGI EXE which is a standard exe program which when run by IIS uses the STDIN and STDOUT channels to decode the request data and send a response back to the client.  This type of EXE is quite envolved but not impossible.

Intrarnets (where all pc's running windows)

3) This option only works on intranets but is quite cool and very affective.  If you want to run the exe on the client system but have it load from a web page there is a cute trick you can do. You register an extension on the client system, say for exmple .SAR.  You can create a text file and rename it, say DoSomething.SAR.  In your text file you place instructions and data like FUNCTION X "\\serverx\data\myfile.xyz".  On the client you register the SAR extension to run an EXE which is loaded on your server.  You can either hard code the SAR files of generate them on the fly and then redirect the client to the file like: "http://serverx/Downloads/YourFunction.sar".  This method is very fast and the user does not see any delay, the exe file loads from the server and starts running.

4) Create a an ActiveX DLL which is registered on your server.  Create a TLB for the DLL which is registered on each client.  The client can link to a script that creates an object on the server.

Set MyObject = CreateObject("MyObject.MyCLass", "serverx")

You can now run methods and get results from the DLL/ or ActiveX EXE running on the server.

Results = MuObject.Run("Passing some data")

Which way do you want to go?
0
 
LVL 76

Expert Comment

by:David Lee
ID: 11775567
"The application involves many forms ..."
Does the user have to interact with the forms?  
0
 
LVL 18

Author Comment

by:Sethi
ID: 11775575
From what I can understand from the above comments is that creating an exe would not be a straight solution. Fair enough. Let's say I drop the idea of full flegded application with 10 forms and create an ActiveX DLL which takes a few parameters from the user. Here are my questions related to it:

1. How will I call this DLL from my ASP page and pass the parameters to it. lets say that instead of creating a form in VB, i create a form in ASP with all required textboxes in it.
2. Is some special settings at IIS required to use this DLL?
0
 
LVL 17

Expert Comment

by:inthedark
ID: 11775596
Another way is you have your exe bind to an ip address & port. Say port 81.  A client can the select a link like this: "Http://serverx/any stuff uou like here?morestuff=here&evenmore=here:81".

When this link is activated IIS is bypassed and your exe will get a connection request.  You accept the connection in an array of winsock controls. You then do the numbercrunching and create an http response string. Actually this way works about 2000 times faster than IIS.

0
 
LVL 18

Author Comment

by:Sethi
ID: 11775605
BlueDevilFan, I was typeing the above comment when you posted your question. I actually need many parameters from the user in various textboxes and that I now think would be possible by creating the asp page itself. However, this data need to be passed to VB DLL. So we are now at a point where the interface will be in ASP and functionality will be performed in VB.
0
 
LVL 18

Author Comment

by:Sethi
ID: 11775629
inthedark, the winsock solution looks very interesting. is is possible that the firewall may play a bad boy's role and not let the exe run?
0
 
LVL 76

Expert Comment

by:David Lee
ID: 11775683
If the program needs to be very interactive, then the DLL approach is probably the best.
0
 
LVL 26

Assisted Solution

by:EDDYKT
EDDYKT earned 100 total points
ID: 11775740
>>1. being an exe the IIS settings may not allow it to run on the server.
IIS allows you to run activex exe. You need to enable the AspAllowOutOfProcComponents flag and put your classname to registry key under
"HKLM\SYSTEM\CurrentControlSet\Services\w3svc\parameters\ADCLaunch"

To enable the flag
ie

    Dim IISComp
   
    On Error Resume Next
    Set IISComp = GetObject("IIS://localhost/W3svc")
    IISComp.Put "AspAllowOutOfProcComponents", True
    IISComp.SetInfo
    Set IISComp = Nothing


>>2. How can the user interact with the exe through a browser. possibly the browser will ask the user to download the exe at his/her machine.
You can start your exe from asp and use XML data island to pass the result back to client

0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 11775776
Use ADCLaunch if and only if you use RDS
0
 
LVL 17

Expert Comment

by:inthedark
ID: 11775791
If you use option 3 above your exe will work as is. All you need to do is register the extension. But this only works in an intranet.

I think that converting a whole app from exe to a DLL that generates HTML is going to take a long time.
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 11775816
0
 
LVL 18

Author Comment

by:Sethi
ID: 11776040
I think I shall go by the DLL method as that looks the best in this situation. The site is hosted on a shared server and we do not have a say to get the IIS settings changed. I am sure DLL's must be used by other sites for some functionalities and IIS would allow that.

My only questions that remained unanswered are:
1. How will I call this DLL from my ASP page and pass the parameters to it. Lets say that instead of creating forms in VB, I create a form in ASP with all required textboxes in it and by pressing Submit, the Dll is called and all the values accepeted from the user arepassedto the DLL.
2. Is some special settings at IIS required to use this DLL?
0
 
LVL 17

Expert Comment

by:inthedark
ID: 11776107
Firewalls can be a problem, if they are then you bind your normal web-site to say port 81 and you listen on port 80.  When you get an http request comming in you decode the request and if you don't recognize the document you just connect to port 81 and send the same data you got from the client.  When the response arrives you echo that back to the client.

Appart from the look of each form, your main conversion problem will be that your exe will want to process all events interactivly. Example say if you have a text box that has some code in a keypress event you have to find a way of doing that using (horrid) client-site scripting.  But a web-server app gets all of the data in one hit so needs to validate the whole screen and then accept thet data or redisplay.  So when you validate your fields you need to store which fields are wrong so that wen you display the results you can display error fields in say red.
0
 
LVL 17

Accepted Solution

by:
inthedark earned 300 total points
ID: 11776580
0
 
LVL 18

Author Comment

by:Sethi
ID: 11779584
Thank you everybody for this help.
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bit defender blocks good applications 2 119
MS Date Picker 64 bit 32 bit issue 12 73
Zip Folders Using Chilkat Routines 1 86
Sub or Function is not defined 6 59
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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

752 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