virtual L_INT LMarker::GetMarker(uIndex, puMarker, puMarkerSize, pMarkerData)
Gets the specified marker in the collection.
Index of the marker to retrieve.
Pointer to a variable to be updated with a value that represents the type (ID) of marker to get. Recommended values are between 0xE0 and 0xFE. Other values are possible, but before using other values, study the JPEG specs to determine which markers are allowed.
Pointer to a variable to be updated with the marker size if pMarkerData is not NULL. The variable should be filled, by the user, with the size of the pMarkerData buffer.
Pointer to a buffer to be updated with the marker data.
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
This function lets you get access to each individual marker without the use of a callback function.
This function is not as efficient as LMarker::Enum because the data for each marker is copied to your buffer.
To get the size of the specified marker, call this function with pMarkerData set to NULL. puMarkerSize will be filled with the size of the marker data.
If pMarkerData is not NULL, then puMarkerSize should be filled with the size of pMarkerData. If the size is not large enough to hold the marker, the function will fail and return ERROR_BUFFER_TOO_SMALL.
If uIndex is larger than the number of markers present in hMarkers, the function will fail and return ERROR_MARKER_INDEX.
Typically, you would call this function twice:
Call it the first time with pMarkerData set to NULL, to find out the size of the marker.
Call it the second time with the pMarkerData set to the buffer you have allocated.
You can also allocate a buffer of 0xFFFD bytes and use it to hold any marker. You can do this because the size of a marker is limited to 0xFFFD (65533) bytes.
L_INT GetMarkerExample(LMarker Markers, HWND hWnd,
L_UCHAR MarkerBuf/* static buffer large
enough to contain any marker*/ )
L_UINT uCount; // number of markers present in Markers
L_UINT uIndex; // index of the marker I am retrieving
L_UINT uMarker; // marker ID (0x01 .. 0xFE)
L_UINT uMarkerSize; // size of marker (0 .. 0xFFFD)
L_INT nRet; // return code
L_TCHAR buf; // buffer used for messages
uCount = Markers.GetCount();
for(uIndex = 0; uIndex < uCount; uIndex++)
// Since I pass MarkerBuf, fill uMarkerSize with the buffer size
uMarkerSize = 0xFFFD;
nRet = Markers.GetMarker(uIndex, &uMarker, &uMarkerSize, MarkerBuf);
if(nRet != SUCCESS)
_itot_s(nRet, buf, 10);
MessageBox(hWnd, buf, TEXT("Error calling GetMarker"), MB_OK);
// the function succeeded
// display the results. Note that the some of
// the marker data displayed is meaningless if uMarkerSize is < 4
wsprintf(buf, TEXT("Marker %d: 0x%02X, size=%d, buf = %02X,%02X,%02X,%02X"),
uIndex, uMarker, uMarkerSize, MarkerBuf, MarkerBuf, MarkerBuf, MarkerBuf);
MessageBox(hWnd, buf, TEXT("SUCCESS"), MB_OK);
MessageBox(hWnd, TEXT("Done"), TEXT("SUCCESS"), MB_OK);
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries