请教对话框关闭时为什么没有预期的效果,求高手帮忙看看这个源码

请问对话框关闭时为什么没有预期的效果,求高手帮忙看看这个源码
错误在OnTimer函数里

------解决方案--------------------
在开始的时候,要setlayer那个函数先出出来,如下。

C/C++ code
HMODULE hmodule;
QIN SetLayeredWindowAttributes;


BOOL CMy123Dlg::OnInitDialog()
{
......
    hmodule = GetModuleHandle("user32.dll");
    SetLayeredWindowAttributes=(QIN)GetProcAddress(hmodule,_T("SetLayeredWindowAttributes"));

    SetWindowLong(GetSafeHwnd(),GWL_EXSTYLE,GetWindowLong(GetSafeHwnd(),GWL_EXSTYLE) | 0x80000L);

    SetLayeredWindowAttributes(GetSafeHwnd(),0,0,0x2);
    SetTimer(WINDOWBEGIN,20,NULL);
    return TRUE;  // return TRUE  unless you set the focus to a control
}