|
|
Comments and Discussions
|
|
 |

|
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:
LPDIRECTDRAW lpddBasic; // Direct Draw version 1 interface pointer
LPDIRECTDRAW4 lpdd4; // Direct Draw interface level 4 interface
// CREATE DIRECT DRAW OBJECT
if(FAILED(DirectDrawCreate(NULL, &lpddBasic, NULL))
return 0;
// GET CURRENT DIRECT DRAW INTERFACE
if(FAILED(lpddBasic->QueryInterface(IID_IDirectDraw4, (void **)&lpdd4)
return 0;
// ALLOW USER TO REBOOT IF THEY WANT TO
if(FAILED(lpddBasic->SetCooperativeLevel(m_hWnd,
DDSCL_ALLOWMODEX | DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE |
DDSCL_ALLOWREBOOT))
return 0;
// ENTER INTO FULLSCREEN MODE
if(FAILED(lpddBasic->SetDisplayMode(1024,768,16,0,0)))
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)
{
BOOL bHide = visible==true?FALSE:TRUE;
CRect rectWorkArea = CRect(0,0,0,0);
CRect rectTaskBar = CRect(0,0,0,0);
CWnd* pWnd = CWnd::FindWindow("Shell_TrayWnd", "");
if( bHide )
{
// Code to Hide the System Task Bar
SystemParametersInfo(SPI_GETWORKAREA,
0,
(LPVOID)&rectWorkArea,
0);
if( pWnd )
{
pWnd->GetWindowRect(rectTaskBar);
rectWorkArea.bottom += rectTaskBar.Height();
SystemParametersInfo(SPI_SETWORKAREA,
0,
(LPVOID)&rectWorkArea,
0);
pWnd->ShowWindow(SW_HIDE);
}
}
else
{
// Code to Show the System Task Bar
SystemParametersInfo(SPI_GETWORKAREA,
0,
(LPVOID)&rectWorkArea,
0);
if( pWnd )
{
pWnd->GetWindowRect(rectTaskBar);
rectWorkArea.bottom -= rectTaskBar.Height();
SystemParametersInfo(SPI_SETWORKAREA,
0,
(LPVOID)&rectWorkArea,
0);
pWnd->ShowWindow(SW_SHOW);
// we have to tell the taskbar
// to recalculate it's size
// by sending it a WM_SIZE message
// simulates user dragging the edge
// with the mouse
pWnd->SendMessage(WM_SIZE, SIZE_RESTORED, (LPARAM)&rectTaskBar);
}
}
}
|
|
|
|

|
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
{
to
class CDialogSK : public CDialog
{
DECLARE_DYNAMIC(CDialogSK)
CDialog.cpp:
typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)
(HWND hWnd, COLORREF cr, BYTE bAlpha, DWORD dwFlags);
lpfnSetLayeredWindowAttributes g_pSetLayeredWindowAttributes;
IMPLEMENT_DYNAMIC(CDialogSK, CDialog)
CDialogSK::CDialogSK(CWnd* pParent /*=NULL*/)
{
_
__ _____ _ __| |_ _____ __
\ \ / / _ \ '__| __/ _ \ \/ /
\ V / __/ | | || __/> <
\_/ \___|_| \__\___/_/\_\
|
|
|
|

|
It solves the problem, Thank you!
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
This article discusses the CDialogSK class that extends the CDialog MFC class and can be used to create dialogs that can be skinned.
| Type | Article |
| Licence | |
| First Posted | 7 Jul 2003 |
| Views | 163,516 |
| Bookmarked | 107 times |
|
|