ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Четверг
18 июля
639176 Топик полностью
Николай Коровин (18.12.2015 14:08 - 14:47, просмотров: 88) ответил Blackbird_sunday на А у когонить готовый живой пример такого досутпа гденить валяется ?:)
Прицепил. Он только на вывод, так что если хотите сначала сграбить текущую картинку — гуглёж и помощь народа, я не помню уже многое. И да, граббер тогда в ответку прицепите, пригодится :)  #include <windows.h> #define LEFTOFFSET 64 #define TOPOFFSET 32 HWND Example_hWnd; HBITMAP Image; BITMAPINFO ImageFormat={sizeof(BITMAPINFO)}; HDC hDC1,hDC2; static char *FrameBuffer; int width, height; void DrawSomething() { for (int i=0; i<width*height*3; i++) FrameBuffer[i]=rand(); SetDIBits(hDC2,Image,0,height,FrameBuffer,&ImageFormat,DIB_RGB_COLORS); SelectObject(hDC2,Image); RedrawWindow(Example_hWnd,NULL,NULL,RDW_INTERNALPAINT); } void Resize (int Width, int Height) { width = Width; height=Height; FrameBuffer=(char*) realloc (FrameBuffer, width*height*3); DeleteObject(Image); ImageFormat.bmiHeader.biWidth=width; ImageFormat.bmiHeader.biHeight=height; //lines from bottom to top // ImageFormat.bmiHeader.biHeight=-height; //lines from top to bottom Image=CreateCompatibleBitmap(hDC1,width,height); } BOOL __export PASCAL ExampleWindowFunction (HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: Example_hWnd=hWnd; FrameBuffer=NULL; Image=NULL; hDC1=GetDC(hWnd);hDC2=CreateCompatibleDC(hDC1); ImageFormat.bmiHeader.biPlanes=1; ImageFormat.bmiHeader.biBitCount=24; ImageFormat.bmiHeader.biCompression=BI_RGB; ImageFormat.bmiHeader.biXPelsPerMeter=1024; ImageFormat.bmiHeader.biYPelsPerMeter=1024; Resize(256, 128); SetTimer (hWnd, 0, 1, NULL); return FALSE; case WM_CLOSE: ReleaseDC(hWnd,hDC1); ReleaseDC(hWnd,hDC2); DeleteObject(Image); free (FrameBuffer); EndDialog (hWnd,NULL); return FALSE; case WM_PAINT: BitBlt(hDC1,LEFTOFFSET,TOPOFFSET,width,height,hDC2,0,0,SRCCOPY); return FALSE; case WM_TIMER: DrawSomething(); } return FALSE; } void main () { DialogBoxParam(GetModuleHandle(NULL),"EXAMPLE",NULL,ExampleWindowFunction,NULL); }