f-in-box question in 16bit screen depth mode

DLL Edition of the F-IN-BOX
fantast_xu
Posts: 8
Joined: Wed Aug 26, 2009 2:32 pm

f-in-box question in 16bit screen depth mode

Postby fantast_xu » Wed Aug 26, 2009 2:53 pm

Hi, I am using f-in-box to get bitmap like this in my code:
*************************************************
void WINAPI FPCListener(HWND hwndFlashPlayerControl, LPARAM lParam, NMHDR* pNMHDR)
{
if (FPCN_PAINT == pNMHDR->code)
{
SFPCNPaint* pFPCNPaint = (SFPCNPaint*)pNMHDR;
LPDWORD lpPixels = pFPCNPaint->lpPixels; // <-- pixels buffer
.........
}
}
**************************************************

in 32bit screen depth mode,this works fine. the lpPixels is 32bit with correct alpha value. But in 16bit screen depth mode, lpPixels's alpha value is alwyas zero.
I guess in 32bit mode, the bitmap data:lpPixels is 32bit, and in 16bit mode, the bitmap data is also 16bit. Maybe 1,5,5,5(ARGB) format. Am I right? And how can I get 32bit bitmap with right alpha channel in 16bit mode?

Thanks a lot!!

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

Postby Softanics » Wed Aug 26, 2009 3:14 pm

Thank you for your question.

One quick question: does Sample #4 (semitransparent top-level window) work well?

Thank you.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

fantast_xu
Posts: 8
Joined: Wed Aug 26, 2009 2:32 pm

Postby fantast_xu » Thu Aug 27, 2009 4:32 am

Yes Sample #4 (semitransparent top-level window) works well in both 32bit and 16bit screen depth mode

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

Re: f-in-box question in 16bit screen depth mode

Postby Softanics » Thu Aug 27, 2009 7:47 am

fantast_xu wrote:in 32bit screen depth mode,this works fine. the lpPixels is 32bit with correct alpha value. But in 16bit screen depth mode, lpPixels's alpha value is alwyas zero.
I guess in 32bit mode, the bitmap data:lpPixels is 32bit, and in 16bit mode, the bitmap data is also 16bit. Maybe 1,5,5,5(ARGB) format. Am I right? And how can I get 32bit bitmap with right alpha channel in 16bit mode?


The format is 32 bit per pixel always, it doesn't matter what display mode is active.

Could you please show me how do you create f-in-box window?

Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

fantast_xu
Posts: 8
Joined: Wed Aug 26, 2009 2:32 pm

Postby fantast_xu » Thu Aug 27, 2009 8:32 am

Hi
Here are some creation codes:

m_hFPC = FPC_LoadRegisteredOCX( );
......
......
......
WNDCLASSEX wc2 = { sizeof(WNDCLASSEX), CS_CLASSDC, WinEndDlgProc, 0L, 0L,
GetModuleHandle(NULL), NULL, NULL
, (HBRUSH) GetStockObject(BLACK_BRUSH), NULL,
_T("IGA_DIALOG_CLASS2"), NULL };

ATOM atom = RegisterClassEx(&wc2);

HWND hwndDlg = NULL;

//////////////////////////////////////////
HGLOBAL hgbl;
LPDLGTEMPLATE lpdt;
LPWORD lpw;
LPWSTR lpwsz;
int nchar;

hgbl = GlobalAlloc(GMEM_ZEROINIT, 1024);
if (!hgbl)
return -1;

lpdt = (LPDLGTEMPLATE)GlobalLock(hgbl);

// Define a dialog box.



lpdt->style = WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_POPUP;
// lpdt->dwExtendedStyle = WS_EX_LAYERED;
lpdt->cdit = 0; // number of controls
lpdt->x = 0; lpdt->y = 0;
lpdt->cx = 1;
lpdt->cy = 1;

lpw = (LPWORD) (lpdt + 1);
*lpw++ = 0; // no menu
*lpw++ = 0; // predefined dialog box class (by default)

lpwsz = (LPWSTR) lpw;
nchar = L"Test";
lpw += nchar;

GlobalUnlock(hgbl);
CreateDialogIndirectParam(wc2.hInstance, (LPDLGTEMPLATE) hgbl, NULL, (DLGPROC) WinEndDlgProc, LPARAM(para));
Sleep(10);


Then in WinEndDlgProc's WM_INITDIALOG, we use code below:
m_hwndFlashPlayerControl = FPC_CreateWindow(m_hFPC, 0 ? WS_EX_LAYERED : 0, NULL, 0 ? WS_POPUP : WS_CHILD | WS_VISIBLE | FPCS_TRANSPARENT,
0, 0, 100, 100, m_ParentHwnd, NULL, NULL, NULL);

which m_ParentHwnd is created by CreateDialogIndirectParam

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

Postby Softanics » Thu Aug 27, 2009 8:54 am

Thank you very much!

fantast_xu wrote:Then in WinEndDlgProc's WM_INITDIALOG, we use code below:
m_hwndFlashPlayerControl = FPC_CreateWindow(m_hFPC, 0 ? WS_EX_LAYERED : 0, NULL, 0 ? WS_POPUP : WS_CHILD | WS_VISIBLE | FPCS_TRANSPARENT,
0, 0, 100, 100, m_ParentHwnd, NULL, NULL, NULL);


Please add the following line:

FPC_PutBackgroundColor(m_hwndFlashPlayerControl, 0x12345667);

after FPC_CreateWindow.

Will you receive non-zero alpha values after this?

Actually, FPCS_TRANSPARENT means pseudo-transparent mode. You provide a background, flash paints over it and you have some result (with alpha). If you use WS_EX_LAYERED, you receive real alpha values.

Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

fantast_xu
Posts: 8
Joined: Wed Aug 26, 2009 2:32 pm

Postby fantast_xu » Thu Aug 27, 2009 10:07 am

Thank you for so quick reply
After add FPC_PutBackgroundColor, The alpha value is not all zero now.
But alpha value is not right.

I followed your suggestion to use full transparent mode, it worked at 16bit well!!
But in this full transparent mode, I can't get flash input command.This is the main reason I using 0 instead of using 1 in FPC_CreateWindow.

my code like this:
case WM_NOTIFY:
{
NMHDR* pNMHDR = (NMHDR*)lParam;

switch (pNMHDR->code)
{
case FPCN_FSCOMMAND:
{
SFPCFSCommandInfoStruct* pInfo = (SFPCFSCommandInfoStruct*)lParam;

if( strcmp( pInfo->command, "quit") == 0 )
{
.......
}
}
}
}

In full transparent mode, I can't receive FPCN_FSCOMMAND message, but Simple transparent mode ok.
Any solution for this?

Thanks again!

BTW, these command codes are in WinEndDlgProc function.

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

Postby Softanics » Thu Aug 27, 2009 2:02 pm

fantast_xu wrote:my code like this:
case WM_NOTIFY:
{
NMHDR* pNMHDR = (NMHDR*)lParam;

switch (pNMHDR->code)
{
case FPCN_FSCOMMAND:
{
SFPCFSCommandInfoStruct* pInfo = (SFPCFSCommandInfoStruct*)lParam;

if( strcmp( pInfo->command, "quit") == 0 )
{
.......
}
}
}
}


Is this a parent window's WndProc?

Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

fantast_xu
Posts: 8
Joined: Wed Aug 26, 2009 2:32 pm

Postby fantast_xu » Thu Aug 27, 2009 3:04 pm

Yes, It's in a parent window's WndProc.

Thanks.

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

Postby Softanics » Thu Aug 27, 2009 4:54 pm

fantast_xu wrote:Yes, It's in a parent window's WndProc.


i.e. m_ParentHwnd, right?

Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

fantast_xu
Posts: 8
Joined: Wed Aug 26, 2009 2:32 pm

Postby fantast_xu » Fri Aug 28, 2009 1:57 am

Yes, we first create a dialog:

WNDCLASSEX wc2 = { sizeof(WNDCLASSEX), CS_CLASSDC, WinEndDlgProc, 0L, 0L,
GetModuleHandle(NULL), NULL, NULL
, (HBRUSH) GetStockObject(BLACK_BRUSH), NULL,
_T("IGA_DIALOG_CLASS2"), NULL };

ATOM atom = RegisterClassEx(&wc2);
......
......

The Dialog's window procedure function is WinEndDlgProc,
In this function, in WM_INITDIALOG message, we first use FPC_CreateWindow to create f-in-box window. m_ParentHwnd is dialog handle.

Then in WM_NOTIFY message(also in dialog's window procedure:WinEndDlgProc) , we process the flash command.

Thanks a lot!

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

Postby Softanics » Fri Aug 28, 2009 5:49 pm

Looks strange, I've checked the code and it should work well.

Could you please insert an assertion:

Code: Select all

m_hwndFlashPlayerControl = FPC_CreateWindow(...);
ASSERT( ::GetParent(m_hwndFlashPlayerControl) == m_ParentHwnd );


Thank you!
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

fantast_xu
Posts: 8
Joined: Wed Aug 26, 2009 2:32 pm

Postby fantast_xu » Sun Aug 30, 2009 12:20 pm

Hi
I inserted an assertion as you said

ASSERT( ::GetParent(m_hwndFlashPlayerControl) == m_ParentHwnd );

The program don't assert at debug version.

I am thinking making a little demonstration program according my real complex one and put here.

Thanks a lot!

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

Postby Softanics » Mon Aug 31, 2009 10:14 am

I've just checked with my movie and WM_NOTIFY works well.

The sample would be great!

Also you can set an event listener:
http://www.f-in-box.com/dll/help/index/ ... tener.html

Thank you!
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

fantast_xu
Posts: 8
Joined: Wed Aug 26, 2009 2:32 pm

Postby fantast_xu » Thu Sep 03, 2009 7:35 am

Hi
Sorry I am a little late for the demo.

The demo was written and compiled under VS2005 with sp1.

Open the sln and in f-in-box_test.cpp line 71:
FPC_CreateWindow(m_hFPC, 1 ? WS_EX_LAYERED : 0, NULL, 1 ? WS_POPUP : WS_CHILD | WS_VISIBLE | FPCS_TRANSPARENT,
0, 0, SWF_W, SWF_H, hDlg, NULL, NULL, NULL);//

When use 1, It can't receive FPCN_FSCOMMAND message If using 0, it works well, you can quit demo by clicking close button in flash.

You can download demo at
I've downloaded the demo, so I've removed the URL :) (admin)

If you can't download demo, PLZ let me know!
Thanks a lot!!


Return to “DLL Edition”

Who is online

Users browsing this forum: No registered users and 5 guests

cron