directx sample

DLL Edition of the F-IN-BOX
luggage
Posts: 1
Joined: Sat Nov 04, 2006 2:51 am

directx sample

Postby luggage » Sat Nov 04, 2006 2:52 am

Hi

Is there any chance of the directx sample being done to use GetDibBits and no transparency please?

Thanks

Scott

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Sun Nov 05, 2006 1:56 pm

Thank you for your question.

I can suggest you how to implement it.

You should create hidden flashplayercontrol window:

Code: Select all

      m_hwndFlashPlayerControl =
         CreateWindow(WC_FLASH,
                   NULL,
                   WS_CHILD | WS_VISIBLE | FPCS_TRANSPARENT,  // FPCS_TRANSPARENT is important
                   rc.left,
                   rc.top,
                   rc.right - rc.left,
                   rc.bottom - rc.top,
                   m_hWnd,
                   NULL,
                   NULL,
                   NULL);


Then load a movie. Set listener:

Code: Select all

FPCSetEventListener(m_hwndFlashPlayerControl, &FPCListener, (LPARAM)this /* or what you want to pass to callback */ );


The listener:

Code: Select all

static LPDWORD g_lpPixels = NULL;
static SIZE g_size = { 0 };

static
void WINAPI FPCListener(HWND hwndFlashPlayerControl, LPARAM lParam, NMHDR* pNMHDR)
{
   if (FPCN_UPDATE_RECT == pNMHDR->code)
   {
      // FPCN_PAINT is sending in the handler of WM_PAINT
      SendMessage(hwndFlashPlayerControl, WM_PAINT, 0, 0);
   }
   else if (FPCN_PAINT == pNMHDR->code)
   {
      SFPCNPaint* pFPCNPaint = (SFPCNPaint*)pNMHDR;
      LPDWORD lpPixels = pFPCNPaint->lpPixels; // <-- pixels buffer
      ATLTRACE(_T("FPCN_PAINT: 0x%.8x\n"), (DWORD)lpPixels);

      RECT rc;
      GetClientRect(hwndFlashPlayerControl, &rc);

      if (g_size.cx != rc.right || g_size.cy != rc.bottom)
      {
         if (NULL != g_lpPixels)
            delete[] g_lpPixels;

         g_size.cx = rc.right;
         g_size.cy = rc.bottom;

         g_lpPixels = new DWORD[g_size.cx * g_size.cy];
      }

      CopyMemory(g_lpPixels, lpPixels, g_size.cx * g_size.cy * sizeof(DWORD));

      // You can copy lpPixels into internal buffer or create what you want from this buffer (bitmaps, textures, etc.)
      // Note that lpPixels is temporary and you shouldn't save this pointer for futher using
   }
}


You can use g_lpPixels / lpPixels to update a texture.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html


Return to “DLL Edition”

Who is online

Users browsing this forum: No registered users and 9 guests