Bonjour,
Je souhaite développer un code en langage c++ permettant de formater un disque dur externe, en utilisant la fonction windows 'DISKPART'.
Le code suivant permet de lancer diskpart avec les privilège admin, puisque chez il fait être admin pour utiliser cette commande. Mais je n'arrive pas à faire la suite, par exemple les commandes 'list disk' qui permet de lister les disque durs branchés, ou 'format' ...etc.
Avez vous des idées ? Merci d'avance.

Code:
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include "windows.h"
#include <shellapi.h>

#include <tchar.h> 

#pragma comment(lib,"shell32.lib") 
static HWND hBut;

using namespace std;

int main()
{
	SHELLEXECUTEINFO shExInfo = { 0 };
	shExInfo.cbSize = sizeof(shExInfo);
	shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
	shExInfo.hwnd = 0;
	shExInfo.lpVerb = _T("runas");									// Operation to perform
	shExInfo.lpFile = _T("C:\\Windows\\System32\\DISKPART.exe");    // Application to start    
	shExInfo.lpParameters = _T("");									 // Additional parameters
	shExInfo.lpDirectory = 0;
	shExInfo.nShow = SW_SHOW;
	shExInfo.hInstApp = 0;

	if (ShellExecuteEx(&shExInfo))
	{
		WaitForSingleObject(shExInfo.hProcess, INFINITE);
		CloseHandle(shExInfo.hProcess);
	}	
}