• An API call query (Acc2k VBA)

    Author
    Topic
    #366107

    I am aware that there is an API call which will kill/destroy a process or program, but I have no idea what it is and can’t find it on the Microsoft site.

    Does anyone know what it is or have a link to a page which has it?

    Thanks

    James

    Viewing 1 reply thread
    Author
    Replies
    • #566830

      Sounds like you need to pay a visit to http://www.allapi.net/. Off the top of my head I don’t know which call you need, but you’ll find it there in their API guide.

      • #567546

        Thanks very much!

        The site is somewhat informative and helpful!

        James

    • #566851

      James, there is ExitProcess (nice) and TerminateProcess (nasty). As Brooke says, AllAPI.net is the place to go for how to use them. Also, if you’re going to get hooked on API calls, you need Dan Appleman’s Visual Basic Programmer’s Guide to the Win32 API. Have fun!

      • #567547

        Hi Sam

        Thanks for the advice about the 2 different calls, problem is that ExitProcess is for the current process that calls it (which is what I do NOT want) and TerminateProcess should do what I want, but doesn’t.

        I’ll definitely remember too look out for the book if I get more into API calls.

        James

        • #567604

          The book say to “post a WM_CLOSE message to the main window of an application to close it.” Now what does that mean? Wish there was some sample code, maybe search allapi for WM_CLOSE. –Sam

          • #567605

            Hi,
            I think you want the PostMessage API call – you’ll need the handle of the window to close too.

            • #568097

              Thanks for the help Rory

              There is definitely a step or something that I am missing and not getting right because it is just not working and I have no idea why!

              James

            • #568366

              I confess I’ve never had to use it, and most of what I’ve seen concerning this sort of thing says it should only be done as an absolute last resort, and may involve enumerating an application’s windows, checking whether they’re enabled and then posting the close message. It could also be that you have a windowless application, in which case I think you’ll need PostAppMessage.
              Hope that’s of some use? Incidentally, can you post the code you have got, on the off chance someone can see why it’s not working?

            • #568493

              Hi there Rory

              After having tested the program on Windows 9x, I am going to have to take the note which says that it should be used as a last resort and not use it.

              I’m going to have to find another method of doing this.

              Thanks for the help anyhow!

              James

          • #567622

            There is sample code at allapi.net. If you have the API-Guide from there, you can look it up on your own PC and copy and paste the code.

    Viewing 1 reply thread
    Reply To: An API call query (Acc2k VBA)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: