Loads extensions from the specified Exif file. Please note that not all Exif files have extensions.
#include "l_bitmap.h"
L_LTFIL_API L_INT L_ReadFileExtensions(pszFile, ppExtensionList, pLoadOptions)
Character string containing Exif file name.
Pointer to a pointer to an EXTENSIONLIST structure to be updated with the extensions read from the specified Exif file.
Pointer to optional extended load options. Pass NULL to use the default load options.
| Value | Meaning |
|---|---|
| >=0 | Length of the comment field. |
| < 0 | An error occurred. Refer to Return Codes. |
Currently, this function works only with Exif files. Exif files can contain extra data stored as "FlashPix extensions". This function can be used to access this extra data. LEADTOOLS refers to this extra data as "extensions".
The L_LoadExtensionStamp function can be used to load a stamp from the extension and L_GetExtensionAudio can be used to get embedded audio data.
When the memory allocated by this function is no longer needed, call L_FreeExtensions to free the memory.
Win32, x64, Linux.
L_INT ReadFileExtensionsExample(HWND hWnd, L_TCHAR * pszName){pEXTENSIONLIST pExtensionList;L_INT nRet;L_UINT u;L_CHAR aName[100];L_TCHAR aCLSID[50];FILE* fd;L_TCHAR szMsg[80];L_TCHAR s[800];nRet = L_ReadFileExtensions(pszName, &pExtensionList, NULL);if(nRet != SUCCESS){wsprintf(szMsg, TEXT("Error %d getting extensions!"), nRet);MessageBox(hWnd, szMsg, TEXT("ERROR"), MB_OK);return nRet;}_tfopen_s(&fd, MAKE_IMAGE_PATH(TEXT("1.txt")), TEXT("w+"));if(!fd){wsprintf(szMsg, TEXT("Error %d getting extensions!"), nRet);MessageBox(hWnd, szMsg, TEXT("ERROR"), MB_OK);return nRet;}// display whether we have a stamp, audio or bothswitch(pExtensionList->uFlags & (EXTENSION_STAMP|EXTENSION_AUDIO)){case 0:lstrcpy(s, TEXT("")); break;case EXTENSION_STAMP:lstrcpy(s, TEXT(", EXTENSION_STAMP")); break;case EXTENSION_AUDIO:lstrcpy(s, TEXT(", EXTENSION_AUDIO")); break;case EXTENSION_STAMP|EXTENSION_AUDIO:lstrcpy(s, TEXT(", EXTENSION_STAMP|EXTENSION_AUDIO")); break;}fprintf(fd, "Extension count: %d%s\n", pExtensionList->uCount, s);for(u = 0; u < pExtensionList->uCount; u++){// translate the Unicode string to multibyteif( !WideCharToMultiByte(CP_ACP, // code page0, // performance and mapping flagspExtensionList->aList[u].pName, // wide-character string-1, // number of chars in stringaName, // buffer for new stringsizeof(aName), // size of bufferNULL, // default for unmappable charsNULL)) // set when default char used{strcpy_s(aName, "ERROR decoding the Unicode string");}if(pExtensionList->aList[u].pClsid){StringFromGUID2((GUID &)pExtensionList->aList[u].pClsid, (LPWSTR)s, sizeof(s));WideCharToMultiByte(CP_ACP, // code page0, // performance and mapping flags(LPWSTR)s, // wide-character string-1, // number of chars in string(LPSTR)aCLSID, // buffer for new stringsizeof(aCLSID), // size of bufferNULL, // default for unmappable charsNULL); // set when default char used}elselstrcpy(aCLSID, TEXT("NULL"));// write information about stream 'u'fprintf(fd, "[%d]: Name=%s, DataSize=%d, CLSID=%s\n", u, aName, pExtensionList->aList[u].uDataSize, aCLSID);}fclose(fd);ShellExecute(hWnd, TEXT("open"),MAKE_IMAGE_PATH(TEXT("1.txt")), NULL, NULL, SW_SHOWNORMAL);L_FreeExtensions(pExtensionList);return SUCCESS;}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
