Показать сообщение отдельно
  #11  
Старый 15.11.2011, 10:00
Аватар для NumLock
NumLock NumLock вне форума
Let Me Show You
 
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
По умолчанию

Код:
var
  ABitmap: TBitmap;
  ADC: HDC;
  ABitmapInfo: TBitmapInfo;
  lpvBits: array of Byte;
begin
  ABitmap:=TBitmap.Create;
  try
    ABitmap.LoadFromFile('0.bmp');
    ADC:=CreateCompatibleDC(0);
    try
      ZeroMemory(@ABitmapInfo.bmiHeader, SizeOf(TBitmapInfoHeader));
      ABitmapInfo.bmiHeader.biSize:=SizeOf(TBitmapInfoHeader);
      if GetDIBits(ADC, ABitmap.Handle, 0, 0, nil, ABitmapInfo, DIB_RGB_COLORS)>0 then
      begin
        SetLength(lpvBits, ABitmapInfo.bmiHeader.biSizeImage);
        if GetDIBits(ADC, ABitmap.Handle, 0, ABitmapInfo.bmiHeader.biHeight,
          lpvBits, ABitmapInfo, DIB_RGB_COLORS)>0 then
        begin
          // lpvBits: array [0..ABitmapInfo.bmiHeader.biSizeImage-1] of R, G, B; - условно
        end else ShowMessage(SysErrorMessage(GetLastError));
      end else ShowMessage(SysErrorMessage(GetLastError));
    finally
      DeleteDC(ADC);
    end;
  finally
    ABitmap.Free;
  end;
end;
__________________
Пишу программы за еду.
__________________
Ответить с цитированием