Results 1 to 4 of 4

Thread: closing a program

  1. #1

    Thread Starter
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    Easiest way of putting this is like the Control+Alt+Delete menu where you can 'End Task' a program I want to do this same thing in VB.
    Thanks in advance.

    ------------------
    DiGiTaIErRoR

  2. #2
    Lively Member
    Join Date
    Nov 1999
    Posts
    64

    Post

    well, this is the only way i know how to do it.

    Code:
    appactivate "[the program's caption]"
    sendkeys "%{F4}", true
    hope it helps



    ------------------
    Charlie Jacquez
    16 Year Old Software Developer
    Email: [email protected]
    Web: CJWARES Online
    AIM: CJWARES, SlimmShadee2000, or BIOSzapper
    ICQ: 58493454
    I program: Basic, Visual Basic, HTML, and TI-Calculators
    My System Specs: Click here


  3. #3

    Thread Starter
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    I need more of a way to 'force it'.

    ------------------
    DiGiTaIErRoR

  4. #4
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    Prague, Czech Republic
    Posts
    350

    Post

    There are two ways to force an application.

    At first, try

    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 it's existence.
    X& = SendMessage(Handle, WM_SYSCOMMAND, SC_CLOSE, NILL)

    ' Enter each of the following Declare statements on one, single line:
    Declare Function FindWindow% Lib "user" (ByVal lpClassName As Any,
    ByVal lpCaption As Any)
    Declare Function SendMessage& Lib "user" (ByVal hwnd%, ByVal wMsg%,
    ByVal wParam%, ByVal lParam As Long)

    ----------------remarks: if you don't know the ClassName, use vbNullString-----------

    I can't find the second method at the moment, I will look up and write you.


    PS: There is a small group of programs (e.g. Acces) that won't end.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width