首页
社区
课程
招聘
[求助]mfc的窗口透明度调整(SetLayeredWindowAttributes函数)
发表于: 2007-5-18 14:31 7124

[求助]mfc的窗口透明度调整(SetLayeredWindowAttributes函数)

2007-5-18 14:31
7124
sdk中好像没有这个函数``所以动态加载了user32这个库`csdn中的代码~~但是偶遇到问题!
SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,   
  GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^0x80000);   
  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,128,2);     
  FreeLibrary(hInst);     
  }  

我用这些代码``改'fun(this->GetSafeHwnd(),0,128,2);'这句的128这个参数,为啥都没变化`

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 615
活跃值: (1127)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
2
这是逆向本站某牛人的crackme 时发现的,具体是谁记不清了,crackme上并没有留大牛的名字

大致代码如下:

.data
GetDllName db "user32.dll",0
GetFunNmae db "SetLayeredWindowAttributes",0
.data?
hDll                dd ?
hFun                dd ?
.....

.if eax==WM_INITDIALOG
       invoke GetWindowLong,hWin,GWL_EXSTYLE
       xor eax,80000h
       invoke SetWindowLong,hWin,GWL_EXSTYLE,eax
       invoke LoadLibrary,offset GetDllName
       mov hDll,eax
       invoke GetProcAddress,hDll,offset GetFunNmae
       mov hFun,eax
       push 2
       push 099h   ;透明度
       push 0  
       push hWin   
       call dword ptr hFun
       invoke FreeLibrary,hDll
2007-5-18 20:39
0
雪    币: 424
活跃值: (10)
能力值: ( LV9,RANK:850 )
在线值:
发帖
回帖
粉丝
3
是这样没错哇`
改那个099h也就是改我的程序那个128``没变化``nnd`
2007-5-19 09:09
0
游客
登录 | 注册 方可回帖
返回
//