Наши проекты:
Журнал · Discuz!ML · Wiki · DRKB · Помощь проекту |
||
ПРАВИЛА | FAQ | Помощь | Поиск | Участники | Календарь | Избранное | RSS |
[13.58.247.31] |
|
Сообщ.
#1
,
|
|
|
GetDIBits все время возвращает null что такое?
даже если buffer null... |
Сообщ.
#2
,
|
|
|
код приведи что-ли... Мало ли почему она у тебя не работает.
Если хелпа нет, то лови кусочек: Цитата Return Values If the lpvBits parameter is non-NULL and the function succeeds, the return value is the number of scan lines copied from the bitmap. Windows 95 and Windows 98: If the lpvBits parameter is NULL and GetDIBits successfully fills the BITMAPINFO structure, the return value is the total number of scan lines in the bitmap. Windows NT: If the lpvBits parameter is NULL and GetDIBits successfully fills the BITMAPINFO structure, the return value is non-zero. If the function fails, the return value is zero. Windows NT: To get extended error information, callGetLastError. |
Сообщ.
#3
,
|
|
|
loadbitmap проходит..значит трабл в чем то другом
но в чем ? #include <windows.h> BITMAPINFO bminf; HDC hdc; HWND hwnd; HBITMAP bit; char buffer[100000]; LRESULT CALLBACK prg(HWND h,UINT msg,WPARAM w,LPARAM l) { switch(msg) { case WM_DESTROY: PostQuitMessage(0); break; default:return(DefWindowProc(h,msg,w,l)); } } int WINAPI WinMain(HINSTANCE h,HINSTANCE h2,LPSTR,int) { MSG msg; WNDCLASS wc; bit=LoadBitmap(h,"chel"); if(bit==NULL) MessageBox(NULL,"GG","!",0); // essesno ne voznikaet memset(&wc,0,sizeof(wc)); wc.lpfnWndProc=prg; wc.hInstance=h; wc.lpszClassName="get"; RegisterClass(&wc); hwnd=CreateWindow("get","o",WS_OVERLAPPEDWINDOW,10,10,100,100,NULL,NULL,h,NULL); hdc=GetDC(hwnd); ////// !!!!!!!! if(GetDIBits(hdc,bit,1,2,buffer,&bminf,DIB_RGB_COLORS)==NULL) MessageBox(NULL,"err dib","!",0); ///// !!!!!! ShowWindow(hwnd,SW_SHOW); while(GetMessage(&msg,NULL,0,0)) DispatchMessage(&msg); } |
Сообщ.
#4
,
|
|
|
HWND hWnd; // твое окошко
HBITMAP hbitmap; // Хэндл на битмапу HDC hdc; hdc = GetDC(hWnd); LPVOID lpvBits; BITMAPINFO bi; /*** Лучше посмотри хэлп по заполнению структуры. Я заполнял так: ***/ bi.bmiHeader.biClrUsed = 0; bi.bmiHeader.biCompression = BI_RGB; bi.bmiHeader.biPlanes = 1; bi.bmiHeader.biBitCount = 24; // Количество цветов bi.bmiHeader.biSize = sizeof(bi.bmiHeader); bi.bmiHeader.biHeight = 100; // высота битмапы bi.bmiHeader.biWidth = 200; // ширина битмапы bi.bmiHeader.biSizeImage = bi.bmiHeader.biHeight*bi.bmiHeader.biWidth*bi.bmiHeader.biBitCount/8; CreateDIBSection(NULL, &bi, DIB_RGB_COLORS, &lpvBits, NULL, NULL); // создаем битмапу GetDIBits(hdc, hbitmap, 0, 100, lpvBits, &bi, DIB_RGB_COLORS); // Получаем биты:) У меня работает так усе:) Лучше поюзай GetBitmapBits; HBITMAP hbitmap; // хэндл на битмапу DWORD dw = 100; // количество бит для чтения LPVOID lp = 0l; . . . VirtualAlloc(...) . . . GetBitmapBits(hbitmap, dw, lp); |