Fixed the issue that the image cannot be loaded from disk in IMAGE meter.

For instance: MeterImage2 fails loading the image.
-----
[CALC]
Measure=CALC
Formula=1

[MeterImage]
Meter=IMAGE
X=0r
Y=0R
ImageName=Image.png
ImageTint=255,255,255,64

[MeterHistogram]
Meter=HISTOGRAM
MeasureName=CALC
X=0r
Y=0r
PrimaryImage=Image.png

[MeterImage2]
Meter=IMAGE
MeterStyle=MeterImage

[MeterHistogram2]
Meter=HISTOGRAM
MeterStyle=MeterHistogram
-----
This commit is contained in:
spx 2010-06-04 08:52:07 +00:00
parent c7cd612502
commit d34c4c2b9c

View File

@ -124,7 +124,7 @@ void CMeterImage::LoadImage(bool bLoadAlways)
}
// Read the bitmap to memory so that it's not locked by GDI+
HANDLE fileHandle = CreateFile(filename.c_str(), GENERIC_READ, NULL, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
HANDLE fileHandle = CreateFile(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (fileHandle != INVALID_HANDLE_VALUE)
{
// Compare the timestamp and filename to check if the file has been changed (don't load if it's not)