Results 1 to 11 of 11
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington (Greater Manchester area)/Cheshire, UK
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    An API call query (Acc2k VBA)

    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

  2. #2
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Reading/Swindon, Berkshire, United Kingdom
    Posts
    664
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: An API call query (Acc2k VBA)

    Sounds like you need to pay a visit to <A target="_blank" HREF=http://www.allapi.net/>http://www.allapi.net/</A>. Off the top of my head I don't know which call you need, but you'll find it there in their API guide.

  3. #3
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: An API call query (Acc2k VBA)

    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 <A target="_blank" HREF=http://www.amazon.com/exec/obidos/ASIN/0672315904/qid=1012310818/sr=8-1/ref=sr_8_67_1/103-7481733-2149446>Dan Appleman's Visual Basic Programmer's Guide to the Win32 API</A>. Have fun!
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington (Greater Manchester area)/Cheshire, UK
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: An API call query (Acc2k VBA)

    Thanks very much!

    The site is somewhat informative and helpful!

    James

  5. #5
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington (Greater Manchester area)/Cheshire, UK
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: An API call query (Acc2k VBA)

    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

  6. #6
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: An API call query (Acc2k VBA)

    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
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  7. #7
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: An API call query (Acc2k VBA)

    Hi,
    I think you want the PostMessage API call - you'll need the handle of the window to close too.
    Regards,
    Rory

    Microsoft MVP - Excel

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: An API call query (Acc2k VBA)

    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.
    Charlotte

  9. #9
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington (Greater Manchester area)/Cheshire, UK
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: An API call query (Acc2k VBA)

    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

  10. #10
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: An API call query (Acc2k VBA)

    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?
    Regards,
    Rory

    Microsoft MVP - Excel

  11. #11
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington (Greater Manchester area)/Cheshire, UK
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: An API call query (Acc2k VBA)

    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

Posting Permissions

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