取得一個值,指出是否已啟用開發人員磁碟機。
語法
DEVELOPER_DRIVE_ENABLEMENT_STATE GetDeveloperDriveEnablementState();
返回值
傳回指出開發人員磁碟機啟用狀態的 DEVELOPER_DRIVE_ENABLEMENT_STATE 值。
備註
GetDeveloperDriveEnablementState 會傳回資訊,指出是否已啟用開發人員磁碟機功能。 如果開發人員雲端硬碟功能已停用,則傳回 的DEVELOPER_DRIVE_ENABLEMENT_STATE 會指出開發人員雲端硬碟是透過群組原則還是本機原則停用。
如果 GetDeveloperDriveEnablementState 失敗,它會傳回 DeveloperDriveEnablementStateError 並設定最後一個錯誤。
範例
下列範例示範如何使用 GetDeveloperDriveEnablementState 來判斷開發人員磁碟驅動器是否已啟用。
#include <Windows.h>
void PrintDevDriveEnabledStatus()
{
DEVELOPER_DRIVE_ENABLEMENT_STATE state = GetDeveloperDriveEnablementState();
switch (state) {
case DeveloperDriveEnabled:
printf("Developer drive is enabled.\n");
break;
case DeveloperDriveDisabledByGroupPolicy:
printf("Developer drive is disabled by Group Policy.\n");
break;
case DeveloperDriveEnablementStateError:
printf("Error querying developer drive info: %d\n", GetLastError());
break;
case DeveloperDriveDisabledBySystemPolicy:
default:
printf("Developer drive is disabled.");
break;
}
}
需求
| Requirement | 價值觀 |
|---|---|
| 最低支援的用戶端 | Windows 11 23H2 [僅限桌面應用程式] |
| 目標平臺 | 窗戶 |
| Header | sysinfoapi.h (包括 Windows.h) |
| Library | mincore.lib |
| DLL | api-ms-win-core-sysinfo-l1-2-6.dll |