Partager via


If your machine freezes, maybe you can reboot it gracefully from another machine

For some reason, one of my machines running Windows XP seemed to die while I was away at a meeting. I could still see all the applications I had left running on the desktop. The physical connections seemed to be fine, but any mouse move or keystroke was ignored. Even Ctrl-Alt-Del didn’t work. I could see the mouse cursor, but it didn’t budge.

It’s on a multiswitch box, which allows me to switch the mouse/keyboard/monitor to any of 3 different machines by a keystroke combination. The switching worked and showed that the mouse/keyboard were working just fine.

I could ping the machine, and it would respond. It’s a web server, and I could hit the web site and it served up web pages as expected.

The UI just seemed totally frozen. I didn’t want to just cycle the power on/off.

So I used the CREATEOBJECTEX( ) Function to create an instance of VFP on that machine and shut it down gracefully. The Kill command from the Windows resource kit sends a message to each app to shutdown. You can also use the TASKKILL command.

ox=CREATEOBJECTEX("visualfoxpro.application","calvinh6")

ox.DoCmd("!/n kill outlook")

ox.DoCmd("!/n kill mstsc")

ox.DoCmd("!/n kill ps")

ox.DoCmd("!/n kill winword")

ox.DoCmd("!/n shutdown -r")

See also Reboot from remote desktop

Comments

  • Anonymous
    July 27, 2006
    When I issue the following command:

    ox=CREATEOBJECTEX('VisualFoxpro.application','BigBoss')

    I'm getting the following error when I try to instantiate a copy of VFP on another machine on my network:

    "OLE error code 0x80070005: Access is denied."

    It sounds like I might have configuration issue on the "BigBoss" machine.

    Got any ideas for me?

    Hugh
  • Anonymous
    July 27, 2006
    Hi Hugh,

    The most common cause of "access denied" is security: you don't have permission to launch the app on the target machine.
    I did a search on "CoCreateInstanceEx Access Denied" and found this article for you

    http://mvb.saic.com/disk$axpdocmar05/progtool/com14/6539pro_001.html