Changeset 36720 in vbox
- Timestamp:
- Apr 18, 2011 5:17:07 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 71237
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
r35907 r36720 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 36 36 #include <iprt/string.h> 37 37 #include <iprt/uuid.h> 38 #include <iprt/file.h> 38 39 #include <VBox/log.h> 39 40 … … 1025 1026 } 1026 1027 } 1028 else if (!strcmp(a->argv[1], "screenshotpng")) 1029 { 1030 if (a->argc <= 2 || a->argc > 4) 1031 { 1032 errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters"); 1033 rc = E_FAIL; 1034 break; 1035 } 1036 int vrc; 1037 uint32_t displayIdx = 0; 1038 if (a->argc == 4) 1039 { 1040 vrc = RTStrToUInt32Ex(a->argv[3], NULL, 0, &displayIdx); 1041 if (vrc != VINF_SUCCESS) 1042 { 1043 errorArgument("Error parsing display number '%s'", a->argv[3]); 1044 rc = E_FAIL; 1045 break; 1046 } 1047 } 1048 ComPtr<IDisplay> pDisplay; 1049 CHECK_ERROR_BREAK(console, COMGETTER(Display)(pDisplay.asOutParam())); 1050 ULONG width, height, bpp; 1051 CHECK_ERROR_BREAK(pDisplay, GetScreenResolution(displayIdx, &width, &height, &bpp)); 1052 com::SafeArray<BYTE> saScreenshot; 1053 CHECK_ERROR_BREAK(pDisplay, TakeScreenShotPNGToArray(displayIdx, width, height, ComSafeArrayAsOutParam(saScreenshot))); 1054 RTFILE pngFile = NIL_RTFILE; 1055 vrc = RTFileOpen(&pngFile, a->argv[2], RTFILE_O_OPEN_CREATE | RTFILE_O_WRITE | RTFILE_O_TRUNCATE); 1056 if (RT_FAILURE(vrc)) 1057 { 1058 RTMsgError("Failed to create file '%s'. rc=%Rrc", a->argv[2], vrc); 1059 rc = E_FAIL; 1060 break; 1061 } 1062 vrc = RTFileWrite(pngFile, saScreenshot.raw(), saScreenshot.size(), NULL); 1063 if (RT_FAILURE(vrc)) 1064 { 1065 RTMsgError("Failed to write screenshot to file '%s'. rc=%Rrc", a->argv[2], vrc); 1066 rc = E_FAIL; 1067 } 1068 RTFileClose(pngFile); 1069 } 1027 1070 else 1028 1071 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r36657 r36720 399 399 RTStrmPrintf(pStrm, 400 400 " setvideomodehint <xres> <yres> <bpp> [display] |\n" 401 " screenshotpng <file> [display] |\n" 401 402 " setcredentials <username> <password> <domain>\n" 402 403 " [--allowlocallogon <yes|no>] |\n"
Note:
See TracChangeset
for help on using the changeset viewer.