<pre class="cpp" name="code">SetWindowLong(this->GetSafeHwnd(), GWL_EXSTYLE, GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^0x80000); </pre><br> <pre></pre> <pre class="cpp" name="code">HINSTANCE hInst = LoadLibrary("User32.DLL"); if(hInst) { typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD); MYFUNC fun = NULL; //取得SetLayeredWindowAttributes函数指针 fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes"); if(fun) { //fun(this->GetSafeHwnd(),0,129,2); fun(this->GetSafeHwnd(),GetSysColor(COLOR_BTNFACE), 129, LWA_COLORKEY); } FreeLibrary(hInst); }</pre> <p><br> 利用以上要领实现半透明窗口时,</p> <p>编译时输出如下:</p> <p>error C2065: 'LWA_COLORKEY' : undeclared identifier</p> <p> </p> <p>显着引入了相关的头文件:#include "WinUser.h",怎么还会提示'LWA_COLORKEY'未界说呢?</p> <p>查察头文件件中的界说发明,是条件界说的问题;</p> <p> </p> <p>在:#include "WinUser.h"之前添加:#define _WIN32_WINNT 0x0502</p> <p>问题办理;</p>
作者:csdn博客 微wx笑