CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2000
    Posts
    16

    Please resond quickly, newbie question

    Hello all. I have been currntly running some apps they make shell calls
    for instance

    call shell("net use p: \blah blah blah\blah",vbHide)
    This does what I need and never shows a prompt. But the problem is that the prompt ,even though hidden is still there, I have to do a control alt del to see it and then end the process. Is there something I can put in that shell command to exit the dos prompt. I know exit use to work for batch files. Thanks for any advice



  2. #2
    Join Date
    Feb 2000
    Location
    Indiana
    Posts
    308

    Re: Please resond quickly, newbie question

    The Shell function returns the process ID of the application that you started. A DOS Window doesn't respond to the WM_CLOSE message (this is the message that politely asks an application to end), so to force it to close would require a couple of things. I haven't done this, so please take this as a suggestion and verify what I'm detailing with someone else or your MSDN library.
    1) Use the process ID to call the OpenProcess() API function with PROCESS_ALL_ACCESS specified.

    2) The OpenProcess call will return a handle to the process. Use this handle to call the TerminateProcess() API function.

    3) To clean up after yourself, call the CloseHandle() API function, providing the handle returned by OpenProcess() as the argument.


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

Featured