哪位朋友能帮我把下在的代码转和为delphi
RGBFRAMECAPTUREDFN  FrameCapturedFn;void RGBCBKAPI FrameCapturedFn (
   HWND                 hWnd,
   HRGB                 hRGB,
   LPBITMAPINFOHEADER   pBitmapInfoHeader,
   void                 *pBitmapBits,
   unsigned long        userData )
{
   PCAPTURE pCapture = NULL;
   unsigned long i;   for ( i = 0; i < NUM_BUFFERS; i++ )
   {
      /* Isolate the capture structure associated with the buffer. */
      if ( &Capture[i].BitmapInfo.bmiHeader == pBitmapInfoHeader )
      {
         pCapture = &Capture[i];
         break;
      }
   }   if ( gBChainBuffer && pCapture )
   {
      /* Has the input signal resolution changed? */
      if ( ( pBitmapInfoHeader->biWidth == gWidth ) && 
           ( abs(pBitmapInfoHeader->biHeight) == gHeight ) )
      {
         TCHAR buffer[MAX_PATH];         _stprintf ( buffer, TEXT("%s\\RGBCAPT%d.BMP"), gDirectory, gFrameCount++ );
         if ( ( pBitmapInfoHeader ) && ( pBitmapBits ) )
            RGBSaveBitmap ( hRGB, pBitmapInfoHeader, pBitmapBits, buffer );         /* We own the buffer until it is passed back into the driver. Once we
          * chain it back in it will be reused in another capture. */
         RGBChainOutputBuffer ( gHRGB, &pCapture->BitmapInfo, pBitmapBits );
      }
      else 
      {
         /* We will drop as many frames as we have buffers currently chained
          * in the driver. If required, modify the code to save a scaled buffer. */
         if ( pCapture->HBitmap )
            DeleteObject( pCapture->HBitmap );         /* Create a new capture structure based on the new width and height. */
         if ( !CreateBitmapAndBuffer ( pCapture, gWidth, gHeight, 
               gBitCount, &ColourMasks[0] ))
         {
            /* Chain the buffer back into the driver list. */
            RGBChainOutputBuffer ( gHRGB, &pCapture->BitmapInfo, 
                  pCapture->PBitmapBits );
         }
      }
   }
}

解决方案 »

  1.   

    仅仅是翻译,楼主自测type RGBFRAMECAPTUREDFN=(m_hWnd: HWND; m_hRGB: HRGB; pBitmapInfoHeader:LPBITMAPINFOHEADER; pBitmapBits:Pointer; userData:Cardinal);stdcall;procedure FrameCapturedFn(m_hWnd: HWND; m_hRGB: HRGB; pBitmapInfoHeader: LPBITMAPINFOHEADER; pBitmapBits: Pointer; userData: Cardinal);stdcall;
    var m_pCapture: PCAPTURE;
        i: Cardinal;
        buffer :string;
    begin
       m_pCapture := nil;
       for i := 0 to NUM_BUFFERS -1 do
       begin
          // Isolate the capture structure associated with the buffer. */
          if ( @Capture[i].BitmapInfo.bmiHeader = pBitmapInfoHeader ) then
          begin
             pCapture = @Capture[i];
             break;
          end;
       end;   if ( gBChainBuffer and pCapture ) then
       begin
          // Has the input signal resolution changed? */
          if ( ( pBitmapInfoHeader.biWidth = gWidth ) and
               ( abs(pBitmapInfoHeader.biHeight) = gHeight ) )
          begin
             buffer := Format('%s\RGBCAPT%d.BMP', [gDirectory,gFrameCount]);
             gFrameCount := gFrameCount + 1;
             if ( ( pBitmapInfoHeader ) and ( pBitmapBits ) ) then
                RGBSaveBitmap ( hRGB, pBitmapInfoHeader, pBitmapBits, buffer );         // We own the buffer until it is passed back into the driver. Once we
             // chain it back in it will be reused in another capture. */
             RGBChainOutputBuffer ( gHRGB, @pCapture.BitmapInfo, pBitmapBits );
          end;
          else
          begin
             // We will drop as many frames as we have buffers currently chained
             // in the driver. If required, modify the code to save a scaled buffer. */
             if ( pCapture.HBitmap )
                DeleteObject( pCapture.HBitmap );         // Create a new capture structure based on the new width and height. */
             if ( not CreateBitmapAndBuffer ( pCapture, gWidth, gHeight,
                   gBitCount, @ColourMasks[0] ))
             begin
                // Chain the buffer back into the driver list. */
                RGBChainOutputBuffer ( gHRGB, @pCapture.BitmapInfo,
                      pCapture.PBitmapBits );
             end;
          end;
       end;
    end;