CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 1999
    Location
    Germany,Bayern,Bad Aibling
    Posts
    9

    Restart a computer



    I have a problem : You see my ISP gives me an IP addressfor three hours and then it changes it. But sometimes I amdoing stuff on my computer or I am just leaving it on standby and it blocks the IP changing request so what I wanted to do was to just make a nice little timer that will tell me to restart my computer or do it itself if I am not there. But I need to know if there is a code that makes a programm reboot the computer....



  2. #2
    Join Date
    Apr 1999
    Posts
    11

    Re: Restart a computer



    Hi,


    you can use the function

    ExitWindowsEx (EWX_REBOOT ,0)


    Raphael

  3. #3
    Join Date
    Apr 1999
    Posts
    306

    Re: Restart a computer

    Just call int 19h in some way

    asm int 0x19

    or get a far pointer to its function and then call it
    See the Assembler Help for the exact memory areas


  4. #4
    Guest

    Re: Restart a computer

    There is an Api that make this and is called ExitWindowsEx the sintax is

    BOOL ExitWindowsEx(UINT uFlags, DWORD dwReserved);

    the argumen uFlags can take this constants:
    For exit windows EWX_SHUT_DOWN
    For Reboot the system EWX_REBOOT

    the second param is reserved for future used and is ignored

    Exampled

    void CShutWindow::OnBottonShutDown()
    { if(!ExitWindowsEx(EWX_SHUTDOWN, 0))
    AfxMessageBox("Can´t shut the system");

    }

    If you have any problem please contact with me.
    I have another problem and if you can help me I agree you.
    This is that I want to capture the entire screen using Visual C++
    and change the resolution of the bitmap for save this in the minium
    space in the disk. If know how to do it or where can I find Help please
    write me. Thenk you


  5. #5
    Join Date
    Mar 2000
    Location
    Japan
    Posts
    134

    Re: Restart a computer

    The following line will restart the computer ::-->
    ExitWindowsEx(EWX_REBOOT,NULL)

    Webmaster of (Code Master)

  6. #6
    Join Date
    Sep 2001
    Location
    Paris, France
    Posts
    12

    Re: Restart a computer

    If you want to restart a computer, I think you must be administrator on your machine. Pay attention to this.


  7. #7
    Join Date
    Sep 2001
    Location
    Paris, France
    Posts
    12

    Re: Restart a computer

    Can you tell me how to get a far pointer to the function "asm int 0x19"? Because I don't get how to include this line into my VC++ program.

    Regards


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