Results 1 to 6 of 6

Thread: App. still there?

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Berlin
    Posts
    44

    Question App. still there?

    Hi,
    I have a VB Appl. which connects to a server and runs through a script on this server. It keeps doing this until the server is either shut-down or the script just dies because of a fatal error. No idea how this works, didin't set it up, but it's not important anyway. Now, this VB Appl. keeps on trying to establish a connection to the server, but obviously fails, if the server isn't there. So, basically, the exe just hangs there. Now I've written a C++ exe which will start this VB app as a service with automatic connection. The C++ program keeps on timing the VB app to check if its still there. Well, that doesn't help, I realized, because the VB prog. is still there, it's still responding, it just can't connect. Anybody have a clue, how I can get a reply from the VB exe which will tell me that it's not getting an answer from the server, so I can kill it and restart it? This task is really killing me, I'm not a programming pro, so I've run out of ideas. Thx in advance.

    Alex
    VB 6.0
    VC++ 6.0
    ABAP

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Can't the VB app simply check if it gets a conection and if not terminate? This would eliminate the need for a C++ app.
    If you can't change the code of the VB app, you try in vain since there is no built-in mechanism to tell you in what state an app is.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Berlin
    Posts
    44
    That woud be possible, problem is, can it restart after it has terminated? The VB app connects to another server and is sort of a server itself, to which clients connect. So, after it hangs up and terminates, it doesn't restart, clients can't connect, basically the same as letting it just hang. Is it possible to restart the app after it has terminated itself? Ideas? Suggestions? Help? Thx. Alex
    VB 6.0
    VC++ 6.0
    ABAP

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    It could create a process then terminate. This process gets the handle of the VB process and waits until it has terminated (WaitForSingleObject). Then it restarts the process and terminates itself.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Berlin
    Posts
    44
    Thx CornedBee. I think I get where you're going. The VB app. runs on start up as a process. It terminates itself when the connection fails. Ok, got that. But I don't understand what you mean with :
    (WaitForSingleObject). Then it restarts the process and terminates itself.
    Do you have an idea how the code would have to look/work? I have never done any work with processes, so I'm really confused at the moment. I wanted to get the process id of the vb app, but I only get the id of the c++ app. I figured out why, but maybe you get the picture, I'm not really that comfy with c++:-)
    Thx again.
    Alex
    VB 6.0
    VC++ 6.0
    ABAP

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    It's a little bit complicated. You basically create the new process with CreateProcess. Then you need to obtain a handle to your own process via GetCurrentProcess and duplicate it for the other process via DuplicateHandle. Meanwhile the other process creates a global event object and waits for it. The VB app writes the duplicated handle to a file, then opens the event object, signals it (the other process can resume execution) and then terminates. The other process reads the process handle from the file, uses it to wait until the VB app has finished, closes the handle, creates the VB app again and then terminates.

    You're gonna learn a lot by this
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

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