문제

am trying to create a project that create a file, formatting it, create a new partition and mount it, dismount it ... in C++ with Qtcretor I found that winapi offer several function help me to do that Format method of the Win32_Volume class and AddMountPoint method of the Win32_Volume class but there is no code example show how to use it I try with WMI C++ Application Examples but in vain

can any one put me on the way please?

Any help will be appreciated and thanks in advance.

도움이 되었습니까?

해결책

Using WMI should be done in Powershell scripts, not C++.

If you're already lost at the beginning, then just limit the use of C++ to CreateProcess() function call with the reference to some Powershell script.

If you insist on writing everything in C++, then the MSDN docs should help you to use the WMI's COM API. There are samples of C++ code. What you call "winapi classes" are really the COM interfaces with all the complications. I think you won't get away by just copy'n'pasting some lines, since COM is not as intuitive as VBScript.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top