在任务栏中显示无边框窗体的图标
在任务栏中只显示了该窗体的Caption属性,而窗体的图标则没有显示出来。同时,
如果你用鼠标右键在任务栏中单击该窗体,原本就显示的系统菜单,现在也没有了。
要解决这个问题,你需要用到下面两个API函数。GetWindowLong和SetWindowLong.
下面是程序示例:
将下面的代码放入窗体的声明段中:
Private Declare Function GetWindowLong Lib "user32" Alias "
GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "
SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal
dwNewLong As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const WS_SYSMENU = &H80000
然后将下面的代码放入窗体的Load事件中:
Dim lStyle As Long
lStyle = GetWindowLong(hWnd, GWL_STYLE) Or _ WS_SYSMENU
SetWindowLong hWnd, GWL_STYLE, lStyle
Tags:
作者:佚名评论内容只代表网友观点,与本站立场无关!
评论摘要(共 0 条,得分 0 分,平均 0 分)
查看完整评论