`BYTE *tp1 = (BYTE*)bmps[nIndex].GetPixelAddress(i,j);` 觸發訪問違例。
// 1. 確認加載成功
if (bmps[nIndex].IsNull()) return;
// 2. 正確參數順序:row=y, col=x
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
BYTE* p = (BYTE*)bmps[nIndex].GetPixelAddress(y, x);
// 檢查 p 是否在有效範圍 (可選)
}
}
// 3. 推薦:LockBits 替代 (同 .NET),但 CImage 無直接 LockBits,
// 可用 GDI+ Bitmap::LockBits 或直接操作 DIBSection 指針
// 參考:https://docs.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-locking-bits-use
見樓主提供的 `LoadCImage` 中 `GetPixelAddress` 遍歷修改像素的正確用法 (注意 `GetWidth()`/`GetHeight()` 順序)。