如题.
我在VC++中可以执行像 Format f: 这样的操作吗?

解决方案 »

  1.   

    system
    winexec
    ShellExecuteEx
    createprocess
      

  2.   

    UINT WinExec(
      LPCSTR lpCmdLine,  // command line
      UINT uCmdShow      // window style
    );BOOL ShellExecuteEx(
        LPSHELLEXECUTEINFO lpExecInfo
    );
      

  3.   

    如果是VC实现你可以参考这个例子:
    http://www.codeproject.com/dialog/cformatdrivedialog.asp
    它是调用了SHFormatDrive (XP/2K only)这个API做的。
      

  4.   

    在VC里调用函数ShellExecute()或WinExec()应该可以。
      

  5.   

    关于这个SHFormatDrive可以参考:
    http://www.china-askpro.com/msg10/qa75.shtml
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shformatdrive.asp
      

  6.   

    执行DOS命令最好是用system函数,比较好玩的。ShellExecute()或WinExec()函数当然也可以了,但是参数太多,对于小小的DOs程序还是System函数比较方便。 system("rundll32.exe user32.dll,LockWorkStation");//锁定计算机的命令
      

  7.   

    感谢各位!
    感谢vcleaner(我没当大哥很久了.......) 给我提供参考方法.
    现在正在学习
      

  8.   

    ResThe format is controlled by the dialog interface. That is, the user must click the OK button to actually begin the format—the format cannot be started programmatically.
    SHFormatDrive还是要跳出界面.
    算了.我看还是要FindWindow SendMessage感谢各位!