Killing a vb executable in jsp

Posted on 2003-03-08
Medium Priority
Last Modified: 2010-08-05
Gud Day!
I have created an executable file in vb6. The logic is simple it pings the server of a site and if the computer is connected it opens the site in ie. Doing this i invoke the internet explorer in my vb executable, and i pass the url.

The problem is whenever i close the browser it does'nt kill my executable. I have no idea on how to kill my executable when i close the browser. My plan is to just call a kill command or something in the logoff button of the .jsp but again i have no idea on how to kill the executable.

Please help me on any feasible solution and could you please give me a sample code. Tnx!
Question by:RikRok
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
  • 2

Accepted Solution

manchanda earned 400 total points
ID: 8097134
in windows killing a application is like this:
but in JSP, u have to see how u can control window process or alternatively where u r calling ie in vb, if sucessfull try to kill or close that vb applicaiton there it self after starting ie for example app.close or stop etc

Steps to Create Example Program

Start Visual Basic 5.0 and select Standard EXE. If Visual Basic 5.0 is already running, click New Project on the File menu and select Standard EXE. Form1 is created by default.

Create two Command Buttons called Command1 and Command2.

On the Project menu, click Add Module (ALT, P, M). Module1 is created by default.

In the Declarations section, declare the following two API functions:

      Declare Function FindWindow _
       Lib "user32" Alias "FindWindowA" _
       (ByVal lpClassName As String, _
       ByVal lpWindowName As String) _
       As Long

      Declare Function SendMessage _
       Lib "user32" Alias "SendMessageA" _
       (ByVal hwnd As Long, _
       ByVal wMsg As Long, _
       ByVal wParam As Long, _
       lParam As Long) _
       As Long

Within the Command1 Click event, add the following code:

      Private Sub Command1_Click()
         Shell "Calc.exe", vbNormalFocus
      End Sub

Within the Command2 Click event, add the following code:

      Private Sub Command2_Click()
         Dim lpClassName As String
         Dim lpCaption As String
         Dim Handle As Long

         Const NILL = 0&
         Const WM_SYSCOMMAND = &H112
         Const SC_CLOSE = &HF060&

         lpClassName = "SciCalc"
         lpCaption = "Calculator"

      '* Determine the handle to the Calculator window.
         Handle = FindWindow(lpClassName$, lpCaption$)

      '* Post a message to Calc to end its existence.
         Handle = SendMessage(Handle, WM_SYSCOMMAND, SC_CLOSE, NILL)

      End Sub

On the Run menu, click Start or press the F5 key to start the program. Clicking the Command1 button starts a (new) instance of the Windows Calculator accessory. Clicking on the Command2 button kills an instance of the Calculator.

Expert Comment

ID: 8097145
if vb code is in a form, use End command after IE call
or u can use a timer which will call End statement.
Or in jsp : Make your application a activeX project , make a reference to this activeX and call a function of this dll which will call End of this activex

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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
Course of the Month13 days, 16 hours left to enroll

801 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