|
Hello, congratullations for this great article and useful code!
May I ask where may this code be used for?
Open source only? Commercial applications? A small launcher in a commercial app (not the app itself)?
I read "copyright to Texas Instruments" in the header file... does this mean it cannot be used at all?
It is a short piece of code, may it be adapted or modified?
Thank you very much in advance!
|
|
|
|
|
Hi
Firstly, thank you for a very usefull and well done class. It has come in usefull more times then i can count
However, i just had a strange problem, that may or may not be related to CDialogSK but i'm hoping somone here can help.
I am running an application, that uses CDialogSK for making skinned dialog pannels(non-modal dialogs),
on a panasonic toughbook computer for some field research. The application works fine on both laptops and desktops,
but on this particular computer the dialogs sort of disapear. Its hard to explain exactly what happens. I have a data entry point with some text on it, and this is shown properly, but the background is gone. It's like the windows redraw/invaliate region functions are not working properly...
Anyone have any idea where to at least start searching for a solutions?
Thanks,
Ole
|
|
|
|
|
|
|
Hello,
First of all, thank you for your great class, it saved me a lot of work and time !!!
I have a problem when using your class for a skinned dialog (ie non-rectangular window), and when calling :
SetTransparent(50);
and after 10 seconds :
SetTransparent(255);
In this case, the transparent color is no more taken into account, and my non-rectangular window becomes rectangular, as the wholebitmap I used as the dialog picture is displayed.
To solve this problem, I had to use :
SetTransparent(255);
SetTransparentColor(RGB(255, 254, 255)); // this is my transparent color
when making the dialog visible again, to get again my non-rectangular dialog.
But I still have the problem, when making the dialog almost invisible by calling :
SetTransparent(50); (but the problem is not so visible as dialog is almost transparent).
Is there a correction for this little (but annoying) bug ? FYI, my PC runs with Windows XP and no service packs at all.
Thank you.
|
|
|
|
|
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
==========================
|
|
|
|
|