mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-11 14:00:32 +08:00
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@52360 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander Trofimov
parent
d15a750e39
commit
7a5a18fb05
@ -0,0 +1,69 @@
|
||||
// MetaDataExample01.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "atlcomcli.h"
|
||||
#include <iostream>
|
||||
#include "conio.h"
|
||||
#include "../../common/utils.h"
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4192)
|
||||
#import "../../bin/AVSImageMetaData.dll" rename_namespace("ImageMetaData")
|
||||
#pragma warning(pop)
|
||||
|
||||
#define HR_RET(HR) if FAILED(hr = (HR)) {_ASSERTE(SUCCEEDED(hr)); std::cout << "failed at line " << __LINE__ << std::endl << std::flush; _getch(); return hr;}
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if (argc <= 1)
|
||||
return 0;
|
||||
|
||||
HR_RET(CoInitialize(NULL));
|
||||
|
||||
CComPtr<ImageMetaData::IImageMetaDataParser> MetaDataParser;
|
||||
HR_RET(MetaDataParser.CoCreateInstance(__uuidof(ImageMetaData::CImageMetaDataParser)));
|
||||
|
||||
try
|
||||
{
|
||||
MetaDataParser->ParseFile(_bstr_t(argv[1]),0);
|
||||
long nMetaDataCount = MetaDataParser->AvailDataTypeCount;
|
||||
|
||||
|
||||
for (int i = 0; i < nMetaDataCount; i++)
|
||||
{
|
||||
long lMetaDataType = MetaDataParser->MetaDataType(i);
|
||||
std::wcout << L"Meta data type: " << lMetaDataType << std::endl;
|
||||
|
||||
std::wcout << L"Specific XML:\n";
|
||||
CComQIPtr<ImageMetaData::IImageMetaDataCommon> iMetaData = MetaDataParser->MetaData(i);
|
||||
_bstr_t bstrResult = iMetaData->GetXML(i);
|
||||
std::wcout << bstrResult << std::endl << std::endl;
|
||||
|
||||
std::wcout << L"Common XML:\n";
|
||||
bstrResult = iMetaData->GetCommonXML(i);
|
||||
std::wcout << bstrResult << std::endl << std::endl;
|
||||
}
|
||||
|
||||
/*_bstr_t bstrCommonResult = iMetaData->GetCommonXML(0);
|
||||
std::wcout << bstrCommonResult;
|
||||
*/
|
||||
|
||||
//CComQIPtr<ImageMetaData::IImageMetaDataExif> iExifMetaData = iMetaData;
|
||||
|
||||
/* int nOrientation = AVS::Utils::lexical_cast<int>(iExifMetaData->GetValue(274));
|
||||
int nImageWidth = AVS::Utils::lexical_cast<int>(iExifMetaData->GetValue(256));*/
|
||||
|
||||
}
|
||||
catch(_com_error & err)
|
||||
{
|
||||
HR_RET(err.Error());
|
||||
}
|
||||
|
||||
_getch();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user