|
Hi, I used your concept to display background Image, Its working Great...
Thank you very much....
|
|
|
|
|
I used this concept for a CFrameWnd and it worked great!!! Thanks a lot.
|
|
|
|
|
Really nice of you to share - great stuff! My question is - how can I create a Media Center type of program? I don't know if your method is the way to do it - but you seem to be the go-to-guy for this type of question! By Media Center type of program, I mean I want my app to be full-screen - without the X on top right and with my own buttons on the dialog to look like an image... But also some kind of nice backdrop....
Any comments would be appreciated!
Thanks,
Mike
|
|
|
|
|
You have basically two ways of creating a Media Center style application, using:
1. DirectX
2. Skinnable DialogBoxes (maybe embedding a Macromedia / Adobe Flash interface)
1. DIRECTX APPROACH
If you want to create a fullscreen app, I'd suggest skipping over this section and concentrating on using DirectX. The technique discussed here is for creating skinnable apps that don't necessarily take over control of the system as media center does.
With fullscreen DirectX, you can pretty much take over the computer's interface and even ignore CTRL+ALT+DEL if you want. Also, you can pretty much lock the video display to prevent other apps from writing to the screen (if your media center type app will be doing all the rendering, like a video game does.)
CODE to start fullscreen DirectX:
<br />
LPDIRECTDRAW lpddBasic;
LPDIRECTDRAW4 lpdd4;
<br />
if(FAILED(DirectDrawCreate(NULL, &lpddBasic, NULL))<br />
return 0;<br />
<br />
if(FAILED(lpddBasic->QueryInterface(IID_IDirectDraw4, (void **)&lpdd4) <br />
return 0;<br />
<br />
if(FAILED(lpddBasic->SetCooperativeLevel(m_hWnd, <br />
DDSCL_ALLOWMODEX | DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE |<br />
DDSCL_ALLOWREBOOT))<br />
return 0;<br />
<br />
if(FAILED(lpddBasic->SetDisplayMode(1024,768,16,0,0))) <br />
return 0;
2. SKINNABLE DIALOGBOX APPROACH
If you decide to use the skinnable dialog, you could set it's Z-order to topmost, and remove all windowing control (WS_POPUP, with NO border and NO titlebar). Additionally, you might want to query the desktop for its HWND pointer and hide the taskbar.
This code will do that for you:
void CMyDialogClass::ShowTaskbar(bool visible)<br />
{<br />
<br />
BOOL bHide = visible==true?FALSE:TRUE;<br />
CRect rectWorkArea = CRect(0,0,0,0);<br />
CRect rectTaskBar = CRect(0,0,0,0);<br />
<br />
CWnd* pWnd = CWnd::FindWindow("Shell_TrayWnd", "");<br />
<br />
if( bHide )<br />
{<br />
SystemParametersInfo(SPI_GETWORKAREA,<br />
0,<br />
(LPVOID)&rectWorkArea,<br />
0);<br />
<br />
if( pWnd )<br />
{<br />
pWnd->GetWindowRect(rectTaskBar);<br />
rectWorkArea.bottom += rectTaskBar.Height();<br />
SystemParametersInfo(SPI_SETWORKAREA,<br />
0,<br />
(LPVOID)&rectWorkArea,<br />
0);<br />
<br />
pWnd->ShowWindow(SW_HIDE);<br />
}<br />
}<br />
else<br />
{<br />
SystemParametersInfo(SPI_GETWORKAREA,<br />
0,<br />
(LPVOID)&rectWorkArea,<br />
0);<br />
if( pWnd )<br />
{<br />
pWnd->GetWindowRect(rectTaskBar);<br />
rectWorkArea.bottom -= rectTaskBar.Height();<br />
SystemParametersInfo(SPI_SETWORKAREA,<br />
0,<br />
(LPVOID)&rectWorkArea,<br />
0);<br />
<br />
pWnd->ShowWindow(SW_SHOW);<br />
pWnd->SendMessage(WM_SIZE, SIZE_RESTORED, (LPARAM)&rectTaskBar);<br />
<br />
}<br />
}<br />
<br />
<br />
}
|
|
|
|
|
Hi,
I tried to implement this ncie work into a small project. After compiling i received alot of C4273 warnings and C2491 errors.
So i changed some code:
CDialogSK.h:
class AFX_EXT_CLASS CDialogSK : public CDialog<br />
{<br />
to
class CDialogSK : public CDialog<br />
{<br />
DECLARE_DYNAMIC(CDialogSK)<br />
CDialog.cpp:
<br />
typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)<br />
(HWND hWnd, COLORREF cr, BYTE bAlpha, DWORD dwFlags);<br />
<br />
lpfnSetLayeredWindowAttributes g_pSetLayeredWindowAttributes;<br />
<br />
IMPLEMENT_DYNAMIC(CDialogSK, CDialog)<br />
<br />
CDialogSK::CDialogSK(CWnd* pParent )<br />
{<br />
_
__ _____ _ __| |_ _____ __
\ \ / / _ \ '__| __/ _ \ \/ /
\ V / __/ | | || __/> <
\_/ \___|_| \__\___/_/\_\
|
|
|
|
|
It solves the problem, Thank you!
|
|
|
|
|
my suituation is
I should not use MFC
want to use skins and should comfortable to all os(windows 95-xp)
now iam using win32 application
size of exe also considerable
To implement skin .i searched in the net. most i got were using bmp files but "i need to use jpeg files"
show me the wright Direction how to accomblish this.
sample code of usig jpeg files/url will help me more
selvaraj
|
|
|
|
|
Yup. Thanks
|
|
|
|
|
You're most welcome
==========================
AB => Code and let code
Go to my home
==========================
|
|
|
|
|
Thanks a lot to Author!
You helped me very much.
Late
|
|
|
|
|
Hi,
I am sorry if I am wrong in any manner.. I am just beginner in VC++. I was trying the CDialogSK class in one of my project on which i needed to use a web page with some video. The base dialog is derived from CDialogSK and webpage with video is placed over the dialogbox and i am using SetTransparentColor to make the dialog transparent. Now when the video starts, the dialog seems to work some strange...Even if i have some other window over my dialog box, the mediaplayer is showing over the other window. I tried using the windows media player control over a dialog box with the base class as CDialogSK and i had the same problem. Is it some mistake i would have made or can we fix the problem with some changes...
Hope we may get some option to solve the problem..
Regards
Vinod
|
|
|
|
|
Hi,
it's a very nice class but I've a problem with Microsoft SMS Remote tools.
When you launch a dialog application written with CDialogSK nothing appears on the remote tool console.
The application is launched on the target PC and the user see the window !!!
Please help me if there's something to do to correct this problem
Best Regards
Anthony
|
|
|
|
|
Hi,
I´m trying to use this class, but i can´t change the dialog´s image to a bitmap image.
I´m using this code:
SetBitmap (IDB_IMAGE); // set background bitmap
SetStyle (LO_STRETCH);
SetTransparentColor(RGB(255,0,255));
Is there anything i´m doing wrong?
|
|
|
|
|
Hi.
Every time the ERASE BACKGROUND is called and no movie can be shown on any window with your GREAT feature. Even some child window will not show any movie .
Is it possible to desactivate the feature in a part of the screen for example.
Do you have an idea ?
Thank you very much
Michael
|
|
|
|
|
Can I use JPEG images instead of Bitmap with your class?
|
|
|
|
|
Yeah you can use but you have to manually convert that JPEG in Bitmap at runtime. IPictureDisp interface will help in this matter
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
This is really nice class, but a problem is when i select the dialog (hold down the left mouse) then there's a dotted-rectangle border around the dialog. I see that other skinned app don't have this. How to HIDE this rect????
Vũ Nãng Lực
|
|
|
|
|
in
BOOL CDialogSK::OnEraseBkgnd(CDC* pDC)
{
...
pbmpOldBmp = (HBITMAP)::SelectObject(dc.m_hDC, m_hBitmap);
...
::SelectObject(dc.m_hDC, m_hBitmap);
return bRetValue;
}
should be ...
BOOL CDialogSK::OnEraseBkgnd(CDC* pDC)
{
...
pbmpOldBmp = (HBITMAP)::SelectObject(dc.m_hDC, m_hBitmap);
...
::SelectObject(dc.m_hDC, pbmpOldBmp);
return bRetValue;
}
|
|
|
|
|
Yes this is a bug. Thanks for pointing this out...
==========================
AB => Code and let code
Go to my home
==========================
|
|
|
|
|
Nothing to thank about ...
i have to thank for this very useful and easy to use class ...
i was looking for a class that does exact what this class does (<< stupid sentence)
Greets and Regards from Germany
.: LegoLas :.
|
|
|
|
|
How can I change dialog skin dynamically using your class. I want to give user, the option to change skins at runtime, (similar to Windows Media Player etc). Can you please guide me to do that. Which dialog handler should call SetBitmap method etc.
ARSALAN MALIK
|
|
|
|
|
Add a another public function named ChangeSkin, that takes the name of a skin file. In that add paths for the background bitmap, color to be made transparent, etc...
Then in ChangeSkin read the file, retrieve the values and call SetBitmap(...), SetTransparentColor(...) and at the end Invalidate the dialog. This will force a repaint and hence the new skin will get applied.
==========================
AB => Code and let code
Go to my home
==========================
|
|
|
|
|
Thankyou. One problem I faced while compiling was AFX_EXT_CLASS , I removed it and every thing worked. Can you tell me what does it mean?;)
ARSALAN MALIK
|
|
|
|
|
I guess you saw my message "Bug in code" below.
AFX_EXT_CLASS is required if you build the class as a seperate DLL. In my original work I used to build all of my controls like CDialogSK, CButtonSK, CUrl as seperate DLLs and use it for my application. If you use static linking this gives a error....
==========================
AB => Code and let code
Go to my home
==========================
|
|
|
|