首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

为什么SetWindowLong没有使窗口最小化。下面是代码解决思路

2012-06-11 
为什么SetWindowLong没有使窗口最小化。下面是代码Option ExplicitPrivate Declare Function GetWindowLong

为什么SetWindowLong没有使窗口最小化。下面是代码
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const GWL_STYLE = (-16)
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const WS_MINIMIZE = &H20000000 '´°¿Ú×îС»¯

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  Dim lwnd As Long
  lwnd = GetWindowLong(Me.hwnd, GWL_STYLE)
  lwnd = lwnd Or WS_MINIMIZE
  Call SetWindowLong(Me.hwnd, -16, lwnd)
End Sub


[解决办法]
http://baike.baidu.com/view/1080272.htm


......
  指定的窗口数据是在缓存中保存的,因此在调用SetWindowLong之后再调用SetWindowPos函数才能使SetWindowLong函数所作的改变生效。
......
[解决办法]
GetWindowLong改变窗口样式,例如有没有最大化按钮,是否在任务栏显示按钮等.


[解决办法]
我记得在哪....看见过说,setwindowlong实现不了窗口最大最小化恢复等窗口操作
还是用 showwindow 吧
setwindowlong 修改窗口属性后一般需要刷新
[解决办法]

探讨
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const GWL_STYLE = (-16)
Private Declare Functio……

热点排行