| View previous topic :: View next topic |
| Author |
Message |
fantast_xu
Joined: 26 Aug 2009 Posts: 8
|
Posted: Wed Aug 26, 2009 2:53 pm Post subject: f-in-box question in 16bit screen depth mode |
|
|
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!! |
|
| Back to top |
|
 |
Softanics Site Admin
Joined: 18 Sep 2004 Posts: 1386 Location: Russia, St. Petersburg
|
Posted: Wed Aug 26, 2009 3:14 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
fantast_xu
Joined: 26 Aug 2009 Posts: 8
|
Posted: Thu Aug 27, 2009 4:32 am Post subject: |
|
|
| Yes Sample #4 (semitransparent top-level window) works well in both 32bit and 16bit screen depth mode |
|
| Back to top |
|
 |
Softanics Site Admin
Joined: 18 Sep 2004 Posts: 1386 Location: Russia, St. Petersburg
|
Posted: Thu Aug 27, 2009 7:47 am Post subject: Re: f-in-box question in 16bit screen depth mode |
|
|
| 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 |
|
| Back to top |
|
 |
fantast_xu
Joined: 26 Aug 2009 Posts: 8
|
Posted: Thu Aug 27, 2009 8:32 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Softanics Site Admin
Joined: 18 Sep 2004 Posts: 1386 Location: Russia, St. Petersburg
|
Posted: Thu Aug 27, 2009 8:54 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
fantast_xu
Joined: 26 Aug 2009 Posts: 8
|
Posted: Thu Aug 27, 2009 10:07 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
Softanics Site Admin
Joined: 18 Sep 2004 Posts: 1386 Location: Russia, St. Petersburg
|
Posted: Thu Aug 27, 2009 2:02 pm Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
fantast_xu
Joined: 26 Aug 2009 Posts: 8
|
Posted: Thu Aug 27, 2009 3:04 pm Post subject: |
|
|
Yes, It's in a parent window's WndProc.
Thanks. |
|
| Back to top |
|
 |
Softanics Site Admin
Joined: 18 Sep 2004 Posts: 1386 Location: Russia, St. Petersburg
|
Posted: Thu Aug 27, 2009 4:54 pm Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
fantast_xu
Joined: 26 Aug 2009 Posts: 8
|
Posted: Fri Aug 28, 2009 1:57 am Post subject: |
|
|
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! |
|
| Back to top |
|
 |
Softanics Site Admin
Joined: 18 Sep 2004 Posts: 1386 Location: Russia, St. Petersburg
|
Posted: Fri Aug 28, 2009 5:49 pm Post subject: |
|
|
Looks strange, I've checked the code and it should work well.
Could you please insert an assertion:
| Code: |
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 |
|
| Back to top |
|
 |
fantast_xu
Joined: 26 Aug 2009 Posts: 8
|
Posted: Sun Aug 30, 2009 12:20 pm Post subject: |
|
|
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! |
|
| Back to top |
|
 |
Softanics Site Admin
Joined: 18 Sep 2004 Posts: 1386 Location: Russia, St. Petersburg
|
|
| Back to top |
|
 |
fantast_xu
Joined: 26 Aug 2009 Posts: 8
|
Posted: Thu Sep 03, 2009 7:35 am Post subject: |
|
|
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!! |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|