作者:绿色风
分类:
时间:2022-08-17
浏览:266
楼主 zlxtl |
Q:默认状态下窗体左上角没有图标,如何添加一个新的图标呢? A:采用API函数调用系统内置的图标即可 以下代码可以单击窗体时随机调用图标
- Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
- Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal Hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
- Private Declare Function DrawMenuBar Lib "user32" (ByVal Hwnd As Long) As Long
- Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
- Private Const WM_SETICON = &H80
- Private Sub UserForm_Click()
- Static i
- Dim Hwnd As Long
- Dim Hicon As Long
- i = i + 1
- Hwnd = FindWindow("ThunderDFrame", Me.Caption)
- Hicon = ExtractIcon(0, "c:\windows\explorer.EXE", i)
- SendMessage Hwnd, WM_SETICON, False, Hicon
- DrawMenuBar Hwnd
- End Sub
|
2楼 xyf2210 |
学习 |
免责声明
有感于原ExcelTip.Net留存知识的价值及部分知识具有的时间限定性因素,
经与ExcelTip.Net站长Apolloh商议并征得其同意,
现将原属ExcelTip.Net的知识帖采集资料于本站点进行展示,
供有需要的人士查询使用,也慰缅曾经的论坛时代。
所示各个帖子的原作者如对版权有异议,
可与本人沟通提出,或于本站点留言,我们会尽快处理。
在此,感谢ExcelTip.Net站长Apolloh的支持,感谢本站点所有人**绿色风(QQ:79664738)**的支持与奉献,特此鸣谢!
------本人网名**KevinChengCW(QQ:1210618015)**原ExcelTip.Net总版主之一