  | 
      
        
          1樓
          巨大八爪鱼
          2016-4-5 14:13
          
          
           
         
        今天能接收图像数据,但是wifi立即失效,无法发送 
       | 
    
    
        | 
      
        
          2樓
          巨大八爪鱼
          2016-4-5 16:07
          
          
           
         
        改成开机时在连接wifi前就立即初始化摄像头:  现在可以了  
       | 
    
    
        | 
      
        
          5樓
          巨大八爪鱼
          2016-4-5 16:13
          
          
           
         
        在开机时就把摄像头初始化好,避免建立wifi线程后再初始化摄像头导致wifi线程卡死
  
       | 
    
    
        | 
      
        
          6樓
          巨大八爪鱼
          2016-4-5 18:05
          
          
           
         
        void drawimg(LPDRAWITEMSTRUCT lpDis) {     BITMAPINFO bmi;     BYTE *p, *pBits;     ZeroMemory(&bmi, sizeof(BITMAPINFO));     bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);     bmi.bmiHeader.biWidth = 800;     bmi.bmiHeader.biHeight = 480;     bmi.bmiHeader.biPlanes = 1;     bmi.bmiHeader.biBitCount = 24;     bmi.bmiHeader.biCompression = BI_RGB;
      HBITMAP hbmp = CreateDIBSection(lpDis->hDC, &bmi, DIB_RGB_COLORS, (LPVOID *)&pBits, NULL, NULL);     HDC hdcMem = CreateCompatibleDC(lpDis->hDC);     SelectObject(hdcMem, hbmp);     FillRect(hdcMem, &lpDis->rcItem, (HBRUSH)GetStockObject(WHITE_BRUSH));
      FILE *fp;     WORD len = 0;     fopen_s(&fp, "reader.jfif", "r");     fread(((BYTE *)&len) + 1, 1, 1, fp);     fread(&len, 1, 1, fp);     fseek(fp, 2, SEEK_CUR); // 跳过两个字节
      int x, y;     WORD wd;     COLORREF color;     int nLineLen = bmi.bmiHeader.biWidth * 3;     if (nLineLen % 4 != 0)         nLineLen += 4 - nLineLen % 4;     for (y = 0; y < bmi.bmiHeader.biHeight; y++)     {         p = pBits + (bmi.bmiHeader.biHeight - y - 1) * nLineLen;         for (x = 0; x < bmi.bmiHeader.biWidth; x++)         {             fread(&wd, 2, 1, fp); // 每隔像素为2字节             color = RGB(wd & 0x1f, (wd >> 5) & 0x3f, (wd >> 11) & 0x1f);             //color = RGB(0, y, x);             *(p + 2) = *((BYTE *)&color);             *(p + 1) = *((BYTE *)&color + 1);             *(p) = *((BYTE *)&color + 2);             p += 3;         }     }     fclose(fp);
      char txt[50];     sprintf_s(txt, "图像大小: %u 字节", len);     SetTextColor(hdcMem, RGB(0, 255, 255));     TextOutA(hdcMem, 10, 10, txt, strlen(txt));
      BitBlt(lpDis->hDC, lpDis->rcItem.left, lpDis->rcItem.top, lpDis->rcItem.right - lpDis->rcItem.left, lpDis->rcItem.bottom - lpDis->rcItem.top, hdcMem, lpDis->rcItem.left, lpDis->rcItem.top, SRCCOPY);     DeleteDC(hdcMem);     DeleteObject(hbmp); } 
       |