Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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.
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

581 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