|
|
Comments and Discussions
|
|
 |

|
If you want to make a shadow in Popup-NonBorder Style,just replace some code, the code in WndShadow.cpp ParentProc()
LRESULT CALLBACK CWndShadow::ParentProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// .................
case WM_SHOWWINDOW:
if(pThis->m_Status & SS_ENABLED && !(pThis->m_Status & SS_DISABLEDBYAERO))
{
LRESULT lResult = pDefProc(hwnd, uMsg, wParam, lParam);
if(!wParam) // the window is being hidden
{
ShowWindow(pThis->m_hWnd, SW_HIDE);
pThis->m_Status &= ~(SS_VISABLE | SS_PARENTVISIBLE);
}
else
{
pThis->m_bUpdate = true;
pThis->Show(hwnd);
LONG lParentStyle = GetWindowLong(hwnd, GWL_STYLE);
if (lParentStyle & 0x80000000)
{
CRect rect;
GetClientRect(hwnd,&rect);
PostMessage(hwnd,WM_SIZE,rect.Width(),rect.Height());
}
// pThis->m_Status |= SS_VISABLE | SS_PARENTVISIBLE;
// ShowWindow(pThis->m_hWnd, SW_SHOWNA);
// pThis->Update(hwnd);
//pThis->m_bUpdate = true;
//pThis->Show(hwnd);
}
return lResult;
}
break;
}
OK! It's work!
|
|
|
|
|

|
This is just what I want!
|
|
|
|

|
I am developing an UI with Popup style and there is no border.I want to add shadow to my UI,then I found this article.But after I add it to my project,I find that it dosen't work......I tried hard to figure out how it works so that I can modify the code to fit my project.unfortunately,I messed up.
Please give some suggestions.....
|
|
|
|

|
Thank you for your work.It help me so much.
|
|
|
|

|
if(j >= szParent.cx) // Start point not found{
ptAnchors[i + 1][0] = szParent.cx;
ptAnchorsOri[i][1] = 0;
ptAnchors[i + 1][0] = szParent.cx;
ptAnchorsOri[i][1] = 0;
}
|
|
|
|

|
Do not Suport Windows 7 And 8, Please Fix
|
|
|
|
|

|
操作系统是Win7
在一个窗口中使用了阴影窗口,但是有时侯会出现崩溃。DBG里面的信息显示return pDefProc(hwnd, uMsg, wParam, lParam);这一句出现问题。根据堆栈里面的信息显示,父窗口析构函数被调用时出现的这一个情况。
我想请问一下什么情况下会出现这种情况?
另外我想请问一下,我是不是需要在这个函数做一些自已的判断?比如判断IsWindow(hwnd),如果为FALSE则调用DefWindowProc()
modified on Tuesday, January 18, 2011 5:06 AM
|
|
|
|

|
Sorry for my absence for quite a long time.
The truth is that I have switched my main OS to Windows 7 and thus not going to maintain this project.
As a result I modified the license attached to the project, especially for commercial use. The project is now under The Microsoft Public License (Ms-PL). The code can be used in both non-commercial and commercial software, NOT requiring any further explicit permission. Applications use this code should place some credit to http://dev.mingliang.org/[^] somewhere like the "about" box. Also, sending me a FYI message is highly approved.
Thank the guys that supported or are interested in this project. You helped a lot.
|
|
|
|

|
Hi there! I found this article a half year ago and thought "Pretty cool! Bookmarked.". Now that I need to give my windows such a cool shadow I would like to use your code. I've sent you an EMail, but I never received a reply from you (Like the guy in the other comment). Maybe it got spam-filtered or whatever.
Would be great if you could send me an approval
|
|
|
|

|
Hi! Good work!
But can you tell me how it can be used with frameless window like a splash?
never say never
|
|
|
|

|
Deleting intermediate files and output files for project 'freepy - Win32 Release'.
--------------------Configuration: freepy - Win32 Release--------------------
Compiling resources...
Compiling...
freepy.c
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(16) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(16) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(22) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(22) : error C2059: syntax error : '<'
应该是vc6中stl template模板类定义的问题,我使用的是非mfc结构的
没有头绪
modified on Monday, July 12, 2010 11:42 PM
|
|
|
|

|
I followed the 4 steps of your instruction and It did have shadow on my frame-based window,but when it comes to my dialog application, It cannot show.
I`m pretty confused...
hope you can help... thx
PS:I have put Create() function in my dialog`s OnInitDialog(), and in my SDI`s OnCreate().
|
|
|
|
|

|
there is a code like below,
SetWindowPos(pThis->m_hWnd, 0, WndRect.left + pThis->m_nxOffset - pThis->m_nSize, WndRect.top + pThis->m_nyOffset - pThis->m_nSize, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE);
it should include SWP_NOZORDER flag
|
|
|
|

|
refer the following link:
http://www.pumzine.com/shadow_bug.png
look at bottom of window.
parent window has round rect region.
CreateRoundRectRgn(0, 0, Width, Height, 20, 20);
according to my investigation, this bug occurs in case of Height > Width.
and this does not happen in all such cases.
|
|
|
|

|
hi,
After building shadow module dll,
and then using this dll in other process, there is a minor bug.
(I am using delphi actually, so I built dll with your code).
In this case, GetWindowLong(GWL_WNDPROC) will return address handle not direct address of window proc.
so below code must change:
pDefProc(hwnd, uMsg, wParam, lParam);
in ParentProc
to:
CallWindowProc(pDefProc, hwnd, uMsg, wParam, lParam);
twice found in ParentProc.
thanks for good job!
|
|
|
|

|
Hi,
This code is not working with child dialog.
It works fine with Parent dialog.
--------------------------
| |
| Parent |
| ------------ |
| | | |
| | child Dlg|* |
| | | | * shadow needed
| ------------ |
| * * |
----------------------------
Parent dilog is a of style overlaped and child dlg of style Child.
if the child dialog is resizable then initialy it will not show shadow
When i resize the child dialog then it works.
Please give solution to above problem
Regards,
SAM
|
|
|
|

|
Hi Mingliang,
First of all thank you for creating wonderful code but unfortunately I am unable to use as I am currently working in .net (and I am sure many many .net users find it very very useful).
Do you know any .net language ? If you do (and don't have much time to make a .net version) then can you please explain the code a bit more so atleast I can try to make a .net version like : what API's you have used or any other functions....because C++ is totally going out of my head and neither any of the so called best c++ to C# (or vb.net) converters are working with it.
I'll be very very grateful if anyone please convert it to .net or atleast explain it a bit more.
|
|
|
|

|
MakeShadow function is awful: function code is too large and there is no verifications, bad names of variables - a lot of memory leaks... TEST your code before showing it to ALL!!
Idea is good , but realisation is very poor.
Code analysis
|
|
|
|

|
wow, it has been a really long time since i have done c++ is there anyway i can talk you into porting this to c# or taking this code and making a managed .Net dll out of it? pretty please?
jberenguer
|
|
|
|

|
if I create a more than one dialogs it crashes on win2003... anybody had same problems?
|
|
|
|

|
I'm currently working on some other project and probably will not be able to see to this problem in a month or so.
I'll try to fix that as soon as i'm free.
Very sorry for that and thanks a lot for your supports.
|
|
|
|

|
I ask a pardon, for my bad English.
If I replace style of window Overlapped on Popup the shadow vanishes.
At me two windows Modal.
At switching problems Alt-Tab I see the name of two windows. This problem is solved with style of affiliated window Popup, but the shadow vanishes
How to me to solve this problem?
In advance thanks
modified on Monday, January 28, 2008 5:17:53 AM
|
|
|
|

|
Hi, I still have it with your latest code...
Any workaround for this?
btw, I have noticed it works in debug version...
but works incorrect in release..
even more, if I start my app from the studio - it works fine!!!
but when I start it outside or by Ctrl-F5 - it does not work well...
modified on Saturday, December 08, 2007 4:12:57 PM
|
|
|
|

|
If parent wnd state is popup wnd?
......
|
|
|
|

|
WndShadow.cpp(580): error C2780: “const _Ty &std::min(const _Ty &,const _Ty &,_Pr)” : want 3 param
http://quickbasic.126.com
|
|
|
|

|
void CMyDlg::OnBnClickedButton1()
{
//CDlgTest dlgTest;
//dlgTest.DoModal();
if (!m_dlgTest.GetSafeHwnd())
{
m_dlgTest.Create(IDD_DIALOG1,this);
}
m_dlgTest.ShowWindow(SW_SHOW);
}
when the m_dlgTest is hided, the m_dlgTest's shadow still exist...
(m_dlgTest is a CDialog.)
http://quickbasic.126.com
|
|
|
|

|
Hi, it is a really good job, thank you for sharing..
I checked your shadow demo on windows NT and windows 98, but it didn't draw any shadows, is there anyway to make it work there?
Also, I checked the shadow demo on windows Vista, and i had shadows, but with the shadow invisible CWnd objects appearing abviously, and i could see that window resizing and moving while i was setting the shadow position and size!!
I dont know if there any workaround to solve that issue too..
Thanks again..
Best Wishes
|
|
|
|

|
Any chance for Shadow of the Child Window ??
|
|
|
|
|

|
I havn't been able to get a chance to go through the source yet and see how you've done it, but all I know is I was able to add your code easily to my Win32 project and it worked beautifuly! As soon as I get some time I really want to dig into it to see the genius of it.
Again, great job and way to write it in pure Win32, as it saved me some time in not having to rewrite MFC to Win32!
Thanks again!
Brandon Yuille
|
|
|
|

|
In case of MSWord Actual text will be drawn in the frame at the window center.
Please let me know how to achieve this functionality.
Thanks in adavnce,
Sandeep
|
|
|
|

|
Hi, I liked the way it works .
I think about porting it in Object Pascal/Delphi. May I post the source somewhere ?
|
|
|
|

|
A nice approach for shadowing. My 5/5!
Suchit.
|
|
|
|

|
Interesting article about window shadows. However it is way too slow and unusable without hardware accelerated alpha blending. But I guess most drivers/graphicscards supports that nowadays.
I have an old Ati 9200 wich DOES support hardware accelerated alphablending. However the driver is VERY buggish. When I use a SINGLE monitor the alphablending is software rendered, but when I use TWO monitors the alphablending is hardware accelerated on the primary monitor.
Good work ATI!
Anyway good work with the shadow implementation!
-----------------------------
I am out of scope
|
|
|
|

|
The window class style CS_DROPSHADOW will do the drop shadow for you on Windows XP and above
|
|
|
|

|
So far the three problems found all share the same cause, which is in these cases the region for the frame windows are not defined. I developed the code on WinXP with theme enabled and I thought in those cases the region would be defined as a recangle. The solution is simple:
Open WndShadow.cpp, around line 325
change:
GetWindowRgn(hParent, hParentRgn);
into:
if(ERROR == GetWindowRgn(hParent, hParentRgn))
{
DeleteObject(hParentRgn);
hParentRgn = CreateRectRgn(0, 0, rcParent->right - rcParent->left, rcParent->bottom - rcParent->top);
}
旧日重来
|
|
|
|

|
Pretty cool, but on XP it doesn't work with 'Classic' Appearance, ie. when Theme skinning is disabled.
|
|
|
|

|
I don´t see any shadows in my Windows 2000 system executing your demo app. Through the demo looks great in my XP system.
Nice feature anyway,
thanks you for sharing.
|
|
|
|

|
It seems that the shadow does not show for a dialog only if the border of the dialog is "Dialog Frame" (I need it to be "Thin"). Or... am I doing something wrong?
thanks
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
An article on how to make application frame window shadowed. MFC/ATL not required.
| Type | Article |
| Licence | Ms-PL |
| First Posted | 13 Nov 2006 |
| Views | 261,652 |
| Downloads | 5,342 |
| Bookmarked | 152 times |
|
|